unity webplayer 与html 传参

来源:互联网 发布:nginx后端服务器监控 编辑:程序博客网 时间:2024/06/08 17:24

unity: 
public void Test(string path) 

tex.text = "web向unity传入服务端地址" + path; 
StartCoroutine(Load(path)); 
}

web:(WebTest.html) 
添加代码: 
window.onload = function(){ 
alert("向unity传消息"); 
u.getUnity().SendMessage("Cube","Test", "qingting.assetbundle"); 
挂脚本的物体是Cube,脚本里调用方法为Test,加载模型为qingting.assetbundle 

qingting.assetbundle 在和WebTest.html 同文件夹下。

注意坑:assetbundle 模型打包时必须为webplayer 平台下

原创粉丝点击