unity webplayer 与html 传参

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 平台下

猜你喜欢

转载自blog.csdn.net/lw450770448/article/details/72287380
今日推荐