入门教程
- 新开一个项目
- 切换到webgl平台
- 下载sdk
使用
打印堆栈
需要到PlayerSettings 里面的Player的Plublishing Settings修改 Enable Exceptions
问题
- MissingMethodException: Default constructor not found
给对应的类加上[Serializable]
或[UnityEngine.Scripting.Preserve]
,类保护的的类也要需要加上。
注意
- 不要使用反射:在WebGL平台上,由于一些限制和安全性考虑,对于反射操作存在一些限制。其中之一是要求被反射的类型必须具有默认构造函数(无参数的构造函数)
相关链接
unity 微信小游戏文档 https://unity.cn/instantgame/docs/WechatMinigame/
unity 微信小游戏git https://github.com/wechat-miniprogram/minigame-unity-webgl-transform
学习代码 https://gitee.com/hahafox_0/unity-tutorial-wxgame.git