[游戏开发][Unity] Xlua生成wrap文件报错、打AB包Wrap报错

 Xlua生成wrap文件,自带添加了ref字段报错

例如Material生成MaterialWrap时,EnableKeyword(in LocalKeyword keyword);带着in关键字,所以在Wrap文件中会自动在参数前生成ref关键字导致编译不过

解决办法:

换Xlua版本就好了,也不知道我xlua当时从哪个版本copy过来的,换了xlua-master里的Xlua源码,再次生成wrap就没问题了。

 打包时Xlua Wrap文件报错:

Assets\XLua\Gen\UnityEngine_AudioSourceWrap.cs(169,57): error CS1061: 'AudioSource' does not contain a definition for 'PlayOnGamepad' and no accessible extension method 'PlayOnGamepad' accepting a first argument of type 'AudioSource' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_AudioSourceWrap.cs(197,57): error CS1061: 'AudioSource' does not contain a definition for 'DisableGamepadOutput' and no accessible extension method 'DisableGamepadOutput' accepting a first argument of type 'AudioSource' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_AudioSourceWrap.cs(227,57): error CS1061: 'AudioSource' does not contain a definition for 'SetGamepadSpeakerMixLevel' and no accessible extension method 'SetGamepadSpeakerMixLevel' accepting a first argument of type 'AudioSource' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_AudioSourceWrap.cs(256,57): error CS1061: 'AudioSource' does not contain a definition for 'SetGamepadSpeakerMixLevelDefault' and no accessible extension method 'SetGamepadSpeakerMixLevelDefault' accepting a first argument of type 'AudioSource' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_AudioSourceWrap.cs(286,57): error CS1061: 'AudioSource' does not contain a definition for 'SetGamepadSpeakerRestrictedAudio' and no accessible extension method 'SetGamepadSpeakerRestrictedAudio' accepting a first argument of type 'AudioSource' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_AudioSourceWrap.cs(311,33): error CS0234: The type or namespace name 'GamepadSpeakerOutputType' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
Assets\XLua\Gen\UnityEngine_AudioSourceWrap.cs(313,63): error CS0117: 'AudioSource' does not contain a definition for 'GamepadSpeakerSupportsOutputType'
Assets\XLua\Gen\UnityEngine_AudioSourceWrap.cs(982,54): error CS1061: 'AudioSource' does not contain a definition for 'gamepadSpeakerOutputType' and no accessible extension method 'gamepadSpeakerOutputType' accepting a first argument of type 'AudioSource' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_AudioSourceWrap.cs(1396,29): error CS0234: The type or namespace name 'GamepadSpeakerOutputType' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
Assets\XLua\Gen\UnityEngine_AudioSourceWrap.cs(1397,23): error CS1061: 'AudioSource' does not contain a definition for 'gamepadSpeakerOutputType' and no accessible extension method 'gamepadSpeakerOutputType' accepting a first argument of type 'AudioSource' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_MeshRendererWrap.cs(137,60): error CS1061: 'MeshRenderer' does not contain a definition for 'scaleInLightmap' and no accessible extension method 'scaleInLightmap' accepting a first argument of type 'MeshRenderer' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_MeshRendererWrap.cs(151,54): error CS1061: 'MeshRenderer' does not contain a definition for 'receiveGI' and no accessible extension method 'receiveGI' accepting a first argument of type 'MeshRenderer' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_MeshRendererWrap.cs(165,61): error CS1061: 'MeshRenderer' does not contain a definition for 'stitchLightmapSeams' and no accessible extension method 'stitchLightmapSeams' accepting a first argument of type 'MeshRenderer' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_MeshRendererWrap.cs(211,35): error CS1061: 'MeshRenderer' does not contain a definition for 'scaleInLightmap' and no accessible extension method 'scaleInLightmap' accepting a first argument of type 'MeshRenderer' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_MeshRendererWrap.cs(227,23): error CS1061: 'MeshRenderer' does not contain a definition for 'receiveGI' and no accessible extension method 'receiveGI' accepting a first argument of type 'MeshRenderer' could be found (are you missing a using directive or an assembly reference?)
Assets\XLua\Gen\UnityEngine_MeshRendererWrap.cs(242,35): error CS1061: 'MeshRenderer' does not contain a definition for 'stitchLightmapSeams' and no accessible extension method 'stitchLightmapSeams' accepting a first argument of type 'MeshRenderer' could be found (are you missing a using directive or an assembly reference?)
Error building Player because scripts had compiler errors

解决方法

 Xlua的配置文件有个专门添加[LuaCallCSharp]、[CSharpCallLua]、[BlackList]的方法,在xlua-master源码里是ExampleGenConfig.cs或者ExampleConfig.cs

BlackList的作用:生成的wrap文件中屏蔽字段和方法

BlackList如何配置:

屏蔽变量和方法的方式如下,都罗列出来了,对号入座。

屏蔽变量 

new List<string>(){"UnityEngine.AudioSource", "gamepadSpeakerOutputType"},

 屏蔽无参方法

new List<string>(){"UnityEngine.AudioSource", "DisableGamepadOutput"},

 屏蔽参数是Int32的方法

new List<string>(){"UnityEngine.AudioSource", "PlayOnGamepad","System.Int32"},

屏蔽多参数方法 

new List<string>(){"UnityEngine.AudioSource", "SetGamepadSpeakerRestrictedAudio","System.Int32","System.Boolean"},

请注意,AudioSource前面的命名空间不能省略

找到BlackList

 //黑名单[BlackList]public static List<List<string>> BlackList = new List<List<string>>()  {new List<string>(){"System.Xml.XmlNodeList", "ItemOf"},new List<string>(){"UnityEngine.WWW", "movie"},#if UNITY_WEBGLnew List<string>(){"UnityEngine.WWW", "threadPriority"},#endifnew List<string>(){"UnityEngine.Texture2D", "alphaIsTransparency"},new List<string>(){"UnityEngine.Security", "GetChainOfTrustValue"},new List<string>(){"UnityEngine.CanvasRenderer", "onRequestRebuild"},new List<string>(){"UnityEngine.Light", "areaSize"},new List<string>(){"UnityEngine.Light", "lightmapBakeType"},#if UNITY_ANDROIDnew List<string>(){"UnityEngine.Light", "SetLightDirty"},new List<string>(){"UnityEngine.Light", "shadowRadius"},new List<string>(){"UnityEngine.Light", "shadowAngle"},#endifnew List<string>(){"UnityEngine.WWW", "MovieTexture"},new List<string>(){"UnityEngine.WWW", "GetMovieTexture"},new List<string>(){"UnityEngine.AnimatorOverrideController", "PerformOverrideClipListCleanup"},#if !UNITY_WEBPLAYERnew List<string>(){"UnityEngine.Application", "ExternalEval"},#endifnew List<string>(){"UnityEngine.GameObject", "networkView"}, //4.6.2 not supportnew List<string>(){"UnityEngine.Component", "networkView"},  //4.6.2 not supportnew List<string>(){"System.IO.FileInfo", "GetAccessControl", "System.Security.AccessControl.AccessControlSections"},new List<string>(){"System.IO.FileInfo", "SetAccessControl", "System.Security.AccessControl.FileSecurity"},new List<string>(){"System.IO.DirectoryInfo", "GetAccessControl", "System.Security.AccessControl.AccessControlSections"},new List<string>(){"System.IO.DirectoryInfo", "SetAccessControl", "System.Security.AccessControl.DirectorySecurity"},new List<string>(){"System.IO.DirectoryInfo", "CreateSubdirectory", "System.String", "System.Security.AccessControl.DirectorySecurity"},new List<string>(){"System.IO.DirectoryInfo", "Create", "System.Security.AccessControl.DirectorySecurity"},new List<string>(){"UnityEngine.MonoBehaviour", "runInEditMode"},};

然后把我下面这一段加入到中间

    //Texturenew List<string>(){"UnityEngine.Texture", "imageContentsHash"},//MeshRenderernew List<string>(){"UnityEngine.MeshRenderer", "scaleInLightmap"},new List<string>(){"UnityEngine.MeshRenderer", "receiveGI"},new List<string>(){"UnityEngine.MeshRenderer", "stitchLightmapSeams"},new List<string>(){"UnityEngine.MeshRenderer", "scaleInLightmap"},new List<string>(){"UnityEngine.MeshRenderer", "receiveGI"},new List<string>(){"UnityEngine.MeshRenderer", "stitchLightmapSeams"},//AudioSourcenew List<string>(){"UnityEngine.AudioSource", "gamepadSpeakerOutputType"},new List<string>(){"UnityEngine.AudioSource", "PlayOnGamepad","System.Int32"},new List<string>(){"UnityEngine.AudioSource", "DisableGamepadOutput"},new List<string>(){"UnityEngine.AudioSource", "SetGamepadSpeakerMixLevel","System.Int32","System.Int32"},new List<string>(){"UnityEngine.AudioSource", "SetGamepadSpeakerMixLevelDefault","System.Int32"},new List<string>(){"UnityEngine.AudioSource", "SetGamepadSpeakerRestrictedAudio","System.Int32","System.Boolean"},new List<string>(){"UnityEngine.AudioSource", "GamepadSpeakerSupportsOutputType","UnityEngine.GamepadSpeakerOutputType"},

再次执行Clear Generated Code、Generated Code后,会发现Wrap文件里的相关变量和方法都消失了。再次打包则不会报错

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/120163.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

单片机为什么一直用C语言,不用其他编程语言?

单片机为什么一直用C语言&#xff0c;不用其他编程语言&#xff1f; 51 单片机规模小得拮据&#xff0c;C 的优势几乎看不到。放个类型信息进去都费劲&#xff0c;你还想用虚函数&#xff1f;还想模板展开&#xff1f;程序轻松破 10k。最近很多小伙伴找我&#xff0c;说想要一些…

大促期间的窜货低价怎么处理

产品窜货往往会伴随低价&#xff0c;所以监测窜货就是要先监测低价&#xff0c;当然有些产品卖价不低价也窜货&#xff0c;但这些正价或者高价卖的链接对渠道影响并不太大&#xff0c;所以治理低价窜货更重要。 力维网络专业为品牌提供窜货治理&#xff0c;低价监测的需求&…

面试必考精华版Leetcode215. 数组中的第K个最大元素

题目&#xff1a; 代码&#xff08;2023年10月27日首刷看解析&#xff09;&#xff1a; class Solution { public:int findKthLargest(vector<int>& nums, int k) {return quickselect(nums,k);}int quickselect(vector<int>& nums,int k){vector<int&…

[UDS] --- WriteDataByIdentifier 0x2E

1 0x2E功能描述 根据ISO14119-1标准中所述&#xff0c;诊断服务2E主要用于Client向Server(ECU)通过DID的方式写入相关的数据。 2 0x2E应用场景 一般而言&#xff0c;对于2E诊断服务&#xff0c;主要应用场景为以下场合&#xff1a; 在整车下线的过程中写入相关配置信息&…

【速看】如何通过合理的封装,让你的自动化脚本更上一层楼!

1. 前言 上一篇推文利用一个在图片范围内实现随机坐标点击的例子&#xff0c;去教会大家如何将自己想要的效果实现出来&#xff0c;受到大家的热情反响&#xff0c;在我们官方讨论群中&#xff0c;还有大佬对我们的示例代码进行优化改进&#xff0c;做了很多合理的函数封装&…

蓝桥杯每日一题2023.10.26

测试次数 - 蓝桥云课 (lanqiao.cn) 题目描述 题目分析 对于本题我们可以使用动态规划来分析 dp[i][j]代表剩余i层&#xff0c;j台手机的情况下对应的测试数量 分类进行讨论一下&#xff1a; 1.当只剩下一台手机的时候&#xff0c;只能从第一层一层一层往上尝试&#xff0c…

电力变压器经济运行研究

摘要 随着科技的发展&#xff0c;电力已成为最重要的资源之一&#xff0c;如何保证电力的供应对于国民经济发展和人民生活水平的提高都有非常重要的意义。在电能输送过程中&#xff0c;电力变压器是整个过程中最重要的一个基本元素&#xff0c;在电力系统中的输送和分配中被广…

Google单元测试sample分析(一)

本文开始从googletest提供的sample案例分析如何使用单元测试&#xff0c; 代码路径在googletest/googletest/samples/sample1.unittest.cc 本文件主要介绍EXPECT*相关宏使用 EXPECT_EQ 判断是否相等 EXPECT_TRUE 是否为True EXPECT_FALSE 是否为False TEST(FactorialTest, N…

时序预测 | Python实现ARIMA-LSTM自回归移动差分模型结合长短期记忆神经网络时间序列预测

时序预测 | Python实现ARIMA-LSTM自回归移动差分模型结合长短期记忆神经网络时间序列预测 目录 时序预测 | Python实现ARIMA-LSTM自回归移动差分模型结合长短期记忆神经网络时间序列预测预测效果基本介绍程序设计参考资料 预测效果 基本介绍 时序预测 | Python实现ARIMA-LSTM自…

颈肩肌筋膜炎做什么检查

颈肩肌筋膜炎症状 颈肩背部广泛疼痛酸胀沉重感、麻木感&#xff0c;僵硬、活动受限&#xff0c;可向后头部及上臂放散。疼痛呈持续性&#xff0c;可因感染、疲劳、受凉、受潮等因素而加重。查体见颈部肌紧张&#xff0c;压痛点常在棘突及棘突旁斜方肌、菱形肌等&#xff0c;压…

基于卷积神经网络的乳腺癌分类 深度学习 医学图像 计算机竞赛

文章目录 1 前言2 前言3 数据集3.1 良性样本3.2 病变样本 4 开发环境5 代码实现5.1 实现流程5.2 部分代码实现5.2.1 导入库5.2.2 图像加载5.2.3 标记5.2.4 分组5.2.5 构建模型训练 6 分析指标6.1 精度&#xff0c;召回率和F1度量6.2 混淆矩阵 7 结果和结论8 最后 1 前言 &…

死锁是什么?如何避免?如何排查?为什么这样排查 详细总结

1.死锁是什么 多个线程访问资源 线程加锁不当 会造成死锁。导致所有线程被阻塞&#xff0c;且无法解开 2.死锁的产生原因 1.加锁后忘记解锁 2.重复加锁&#xff0c;造成死锁 3.B锁内部调用函数A &#xff0c;A运行是又加锁 导致A,B均无法运行 3.如何避免死锁 多检查…

C++中invoke与function的区别

C invoke invoke是C17标准引入的一个函数模板&#xff0c;用来调用可调用对象&#xff08;Callable Object&#xff0c;如函数指针、函数对象、成员函数指针等&#xff09;并返回结果。 invoke提供了统一的调用语法&#xff0c;无论可调用对象的类型是什么&#xff0c;都可以…

一文讲明白阿里云ace认证的含金量!

《中国云计算行业洞察与人才分析》显示&#xff0c;云计算领域人才月均薪酬在1W元以上的占比高达93.7%&#xff0c;3万元以上占比仍达24.7%。 相比之下&#xff0c;云计算人才远超互联网人才薪酬平均线&#xff0c;反映出市场对于其专业技术人才的需求。 云计算架构师、云计算…

2016年亚太杯APMCM数学建模大赛B题化学元素对变形钢筋性能的影响求解全过程文档及程序

2016年亚太杯APMCM数学建模大赛 B题 化学元素对变形钢筋性能的影响 原题再现 热轧带肋钢筋通常被称为变形钢筋&#xff0c;它主要用于钢筋混凝土构件的骨架&#xff0c;在使用中需要一定的机械强度、弯曲和变形性能、制造焊接性。钢中的化学成分是影响热轧钢最终组织性能的基…

Go 命令大全:全面解析与实践

一、Go命令全列表 在这部分&#xff0c;我们将通过一个表格来快速浏览Go语言的所有内建命令及其基本功能。这些命令涵盖了从代码构建、测试&#xff0c;到依赖管理和其他工具等方面。 命令功能描述go build编译Go源文件go run编译并运行Go程序go get下载并安装依赖或项目go m…

Linux基础知识——概述和常用文件管理命令

Linux基础知识——概述和常用文件管理命令 文章目录 Linux基础知识——概述和常用文件管理命令概述常用的一些文件指令 概述 终端&#xff1a;一个terminal窗口就是以个屏幕, 远程连接了一个服务器, 每一个terminal可以连接到任何一个其他服务器上;关掉terminal相当于只是关掉…

使用Typecho搭建个人博客网站,并内网穿透实现公网访问——“cpolar内网穿透”

使用Typecho搭建个人博客网站&#xff0c;并内网穿透实现公网访问 文章目录 使用Typecho搭建个人博客网站&#xff0c;并内网穿透实现公网访问前言1. 安装环境2. 下载Typecho3. 创建站点4. 访问Typecho5. 安装cpolar6. 远程访问Typecho7. 固定远程访问地址8. 配置typecho 前言 …

使用DBSyncer实现增量Mysql到Mysql的数据同步_DBSyncer1.2.4版本---数据同步之DBSyncer工作笔记006

之前都是用来postgresql到mysql的同步,需要配置postgresql的复制槽,对于mysq来说,需要配置: mysql启用binlog: https://gitee.com/ghi/dbsyncer/wikis/%E6%93%8D%E4%BD%9C%E6%89%8B%E5%86%8C/%E6%97%A5%E5%BF%97%E9%85%8D%E7%BD%AE%EF%BC%88%E6%95%B0%E6%8D%AE%E6%BA%90%EF%B…

【Linux】Centos yum源替换

YUM是基于RPM包管理&#xff0c;能够从指定的服务器自动下载RPM包并且安装&#xff0c;可以自动处理依赖性关系&#xff0c;并且一次安装所有依赖的软件包&#xff0c;无须繁琐地一次次下载、安装。 CentOS 8操作系统版本结束了生命周期&#xff08;EOL&#xff09;&#xff0…