找回密码
 立即注册
查看: 312|回复: 0

Xlua报错解决方案

[复制链接]
发表于 2021-8-12 09:21 | 显示全部楼层 |阅读模式
报错展示

在编译器中运行完好,没什么问题,但是打包时会报这些错,



解决方案

找到Xlua路径Assets/XLua/Editor/ExampleConfig.cs这个脚本,我们会看到有一个BlackList,至于BlackList是做什么的,在Xlua的教程文档里有解释:
如果你不要生成一个类型的一些成员的适配代码,你可以通过这个配置来实现。
标签方式比较简单,对应的成员上加就可以了。
由于考虑到有可能需要把重载函数的其中一个重载列入黑名单,配置方式比较复杂,类型是List<List>,对于每个成员,在第一层List有一个条目,第二层List是个string的列表,第一个string是类型的全路径名,第二个string是成员名,如果成员是一个方法,还需要从第三个string开始,把其参数的类型全路径全列出来。
例如:
  1. [BlackList]publicstatic List<List<string>> BlackList =newList<List<string>>(){newList<string>(){"UnityEngine.GameObject","networkView"},newList<string>(){"System.IO.FileInfo","GetAccessControl","System.Security.AccessControl.AccessControlSections"},};
复制代码
这里我们报错的几个方法加入到BlackList中:
如下:
  1. [BlackList]publicstatic List<List<string>> BlackList =newList<List<string>>(){newList<string>(){"System.Xml.XmlNodeList","ItemOf"},newList<string>(){"UnityEngine.WWW","movie"},
  2.     #ifUNITY_WEBGLnewList<string>(){"UnityEngine.WWW","threadPriority"},
  3.     #endif
  4.                 newList<string>(){"UnityEngine.Texture2D","alphaIsTransparency"},newList<string>(){"UnityEngine.Security","GetChainOfTrustValue"},newList<string>(){"UnityEngine.CanvasRenderer","onRequestRebuild"},newList<string>(){"UnityEngine.Light","areaSize"},newList<string>(){"UnityEngine.Light","lightmapBakeType"},newList<string>(){"UnityEngine.WWW","MovieTexture"},newList<string>(){"UnityEngine.WWW","GetMovieTexture"},newList<string>(){"UnityEngine.Light","SetLightDirty"},newList<string>(){"UnityEngine.Light","shadowRadius"},newList<string>(){"UnityEngine.Light","shadowAngle"},newList<string>(){"UnityEngine.Light","shadowRadius"},newList<string>(){"UnityEngine.AnimatorOverrideController","PerformOverrideClipListCleanup"},
  5.     #if!UNITY_WEBPLAYERnewList<string>(){"UnityEngine.Application","ExternalEval"},
  6.     #endif
  7.                 newList<string>(){"UnityEngine.GameObject","networkView"},//4.6.2 not supportnewList<string>(){"UnityEngine.Component","networkView"},//4.6.2 not supportnewList<string>(){"System.IO.FileInfo","GetAccessControl","System.Security.AccessControl.AccessControlSections"},newList<string>(){"System.IO.FileInfo","SetAccessControl","System.Security.AccessControl.FileSecurity"},newList<string>(){"System.IO.DirectoryInfo","GetAccessControl","System.Security.AccessControl.AccessControlSections"},newList<string>(){"System.IO.DirectoryInfo","SetAccessControl","System.Security.AccessControl.DirectorySecurity"},newList<string>(){"System.IO.DirectoryInfo","CreateSubdirectory","System.String","System.Security.AccessControl.DirectorySecurity"},newList<string>(){"System.IO.DirectoryInfo","Create","System.Security.AccessControl.DirectorySecurity"},newList<string>(){"UnityEngine.MonoBehaviour","runInEditMode"},};
复制代码

主要就是将报错的几个方法加入到BlackList中,然后


先清理之前生成的代码
接着再重新生成下代码:


接下来重新打包就可以愉快的玩耍了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-11-24 07:06 , Processed in 0.091547 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表