绍兴柯桥建设局网站,网站建设教程搭建湖南岚鸿,wordpress 移动端优势,上传网站步骤Xlua生成wrap文件#xff0c;自带添加了ref字段报错 例如Material生成MaterialWrap时#xff0c;EnableKeyword(in LocalKeyword keyword);带着in关键字#xff0c;所以在Wrap文件中会自动在参数前生成ref关键字导致编译不过
解决办法#xff1a;
换Xlua版本就好了#… 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 Liststring(){UnityEngine.AudioSource, gamepadSpeakerOutputType}, 屏蔽无参方法
new Liststring(){UnityEngine.AudioSource, DisableGamepadOutput}, 屏蔽参数是Int32的方法
new Liststring(){UnityEngine.AudioSource, PlayOnGamepad,System.Int32},
屏蔽多参数方法
new Liststring(){UnityEngine.AudioSource, SetGamepadSpeakerRestrictedAudio,System.Int32,System.Boolean},
请注意AudioSource前面的命名空间不能省略 找到BlackList //黑名单[BlackList]public static ListListstring BlackList new ListListstring() {new Liststring(){System.Xml.XmlNodeList, ItemOf},new Liststring(){UnityEngine.WWW, movie},#if UNITY_WEBGLnew Liststring(){UnityEngine.WWW, threadPriority},#endifnew Liststring(){UnityEngine.Texture2D, alphaIsTransparency},new Liststring(){UnityEngine.Security, GetChainOfTrustValue},new Liststring(){UnityEngine.CanvasRenderer, onRequestRebuild},new Liststring(){UnityEngine.Light, areaSize},new Liststring(){UnityEngine.Light, lightmapBakeType},#if UNITY_ANDROIDnew Liststring(){UnityEngine.Light, SetLightDirty},new Liststring(){UnityEngine.Light, shadowRadius},new Liststring(){UnityEngine.Light, shadowAngle},#endifnew Liststring(){UnityEngine.WWW, MovieTexture},new Liststring(){UnityEngine.WWW, GetMovieTexture},new Liststring(){UnityEngine.AnimatorOverrideController, PerformOverrideClipListCleanup},#if !UNITY_WEBPLAYERnew Liststring(){UnityEngine.Application, ExternalEval},#endifnew Liststring(){UnityEngine.GameObject, networkView}, //4.6.2 not supportnew Liststring(){UnityEngine.Component, networkView}, //4.6.2 not supportnew Liststring(){System.IO.FileInfo, GetAccessControl, System.Security.AccessControl.AccessControlSections},new Liststring(){System.IO.FileInfo, SetAccessControl, System.Security.AccessControl.FileSecurity},new Liststring(){System.IO.DirectoryInfo, GetAccessControl, System.Security.AccessControl.AccessControlSections},new Liststring(){System.IO.DirectoryInfo, SetAccessControl, System.Security.AccessControl.DirectorySecurity},new Liststring(){System.IO.DirectoryInfo, CreateSubdirectory, System.String, System.Security.AccessControl.DirectorySecurity},new Liststring(){System.IO.DirectoryInfo, Create, System.Security.AccessControl.DirectorySecurity},new Liststring(){UnityEngine.MonoBehaviour, runInEditMode},};
然后把我下面这一段加入到中间 //Texturenew Liststring(){UnityEngine.Texture, imageContentsHash},//MeshRenderernew Liststring(){UnityEngine.MeshRenderer, scaleInLightmap},new Liststring(){UnityEngine.MeshRenderer, receiveGI},new Liststring(){UnityEngine.MeshRenderer, stitchLightmapSeams},new Liststring(){UnityEngine.MeshRenderer, scaleInLightmap},new Liststring(){UnityEngine.MeshRenderer, receiveGI},new Liststring(){UnityEngine.MeshRenderer, stitchLightmapSeams},//AudioSourcenew Liststring(){UnityEngine.AudioSource, gamepadSpeakerOutputType},new Liststring(){UnityEngine.AudioSource, PlayOnGamepad,System.Int32},new Liststring(){UnityEngine.AudioSource, DisableGamepadOutput},new Liststring(){UnityEngine.AudioSource, SetGamepadSpeakerMixLevel,System.Int32,System.Int32},new Liststring(){UnityEngine.AudioSource, SetGamepadSpeakerMixLevelDefault,System.Int32},new Liststring(){UnityEngine.AudioSource, SetGamepadSpeakerRestrictedAudio,System.Int32,System.Boolean},new Liststring(){UnityEngine.AudioSource, GamepadSpeakerSupportsOutputType,UnityEngine.GamepadSpeakerOutputType},
再次执行Clear Generated Code、Generated Code后会发现Wrap文件里的相关变量和方法都消失了。再次打包则不会报错