当前位置:   article > 正文

【Unity3D】Unity使用自己生成的DLL文件_unity生成dll文件

unity生成dll文件

目录

 

生成DLL文件

创建DLL类库工程

生成DLL文件

Unity使用DLL文件

 打版WebGL


生成DLL文件

创建DLL类库工程

测试的时候,如果有多个class,可以写到一个文件中;多个文件的没有测试

生成DLL文件

 

Unity使用DLL文件

放到Unity工程的Asset->Plugins文件夹下。“虽然”这个操作没有起作用,但是还是规范下比较好。

 

本地操作可以正常使用,但是后面的打包WebGL却有问题

 打版WebGL

出现过找不到DLLNotFond的问题;不报错但是读取配置文件,没有值的问题

解决方案:主场景中创建一个空物体,将DLL文件挂载上去;

  1. public class MonoSingletonBase<T> : MonoBehaviour where T : MonoBehaviour
  2. {
  3. private static object _singletonLock = new object();
  4. private static T _instance;
  5. public static T Instance
  6. {
  7. get
  8. {
  9. if (_instance == null)
  10. {
  11. lock (_singletonLock)
  12. {
  13. T[] singletonInstances = FindObjectsOfType(typeof(T)) as T[];
  14. if (singletonInstances.Length == 0) return null;
  15. if (singletonInstances.Length > 1)
  16. {
  17. if (Application.isEditor)
  18. UnityEngine.Debug.LogWarning(
  19. "MonoSingleton<T>.Instance: Only 1 singleton instance can exist in the scene. Null will be returned.");
  20. return null;
  21. }
  22. _instance = singletonInstances[0];
  23. }
  24. }
  25. return _instance;
  26. }
  27. }
  28. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/89009
推荐阅读
相关标签
  

闽ICP备14008679号