Unity 4.6升级到Unity 5,遇到3个GetTriangleStrip 相关warning的解决方法

转载:http://weibo.com/p/1001603906313603156948
黄色加亮是错误警告,error严重程度高,分别为
1) Assets/Standard Assets/Scripts/MeshCombineUtility.cs(27,74): error CS1061: Type `UnityEngine.Mesh' does not contain a definition for `GetTriangleStrip' and no extension method `GetTriangleStrip' of type `UnityEngine.Mesh' could be found (are you missing a using directive or an assembly reference?)

2) Assets/Standard Assets/Scripts/MeshCombineUtility.cs(130,73): error CS1061: Type `UnityEngine.Mesh' does not contain a definition for `GetTriangleStrip' and no extension method `GetTriangleStrip' of type `UnityEngine.Mesh' could be found (are you missing a using directive or an assembly reference?)

3) Assets/Standard Assets/Scripts/MeshCombineUtility.cs(177,30): error CS1061: Type `UnityEngine.Mesh' does not contain a definition for `SetTriangleStrip' and no extension method `SetTriangleStrip' of type `UnityEngine.Mesh' could be found (are you missing a using directive or an assembly reference?)

总之都是方法名变了的错。

把GetTriangleStrip改成GetTriangles,对应着SetTriangleStrip也要改成SetTriangles。
完工。
还有什么坑以后再填。
感谢unity论坛的答疑帖:http://forum.unity3d.com/threads/meshcombineutility-error.307938/
  • 9
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
要在 H5 中调用 Unity 的原生方法,需要通过 WebGL 将 Unity 嵌入到 H5 页面中。下面是一个简单的案例: 1. 创建 Unity 项目并设置 发布 2. 在 Unity 项目中定义要暴露给 H5 的函数,并使用 [DllImport] 特性将其标记为导出函数。例如: ``` public class MyUnityScript : MonoBehaviour { [DllImport("__Internal")] private static extern void MyNativeFunction(string message); public void CallMyNativeFunction(string message) { MyNativeFunction(message); } } ``` 3. 在 H5 页面中插入 Unity Web Player,例如: ``` <div id="unityPlayer"></div> <script type="text/javascript"> var unityInstance = UnityLoader.instantiate("unityPlayer", "Build/UnityWebGL.json"); </script> ``` 4. 在 H5 中调用导出函数,例如: ``` <button onclick="unityInstance.SendMessage('MyGameObject', 'CallMyNativeFunction', 'Hello from H5!')">Call Unity Function</button> ``` 这里通过 UnityInstance.SendMessage() 方法调用了 MyUnityScript.CallMyNativeFunction() 函数,并将消息参数传递给它。 5. 最后在 Unity 中实现 MyNativeFunction() 函数,例如: ``` [DllImport("__Internal")] private static extern void MyNativeFunction(string message); void MyNativeFunction(string message) { Debug.Log("Native function called with message: " + message); } ``` 这样,当 H5 页面中的按钮被点击时,就会调用 MyUnityScript.CallMyNativeFunction() 函数,该函数又会调用 MyNativeFunction() 函数,并在 Unity 控制台中输出消息。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值