Unity3d导出Xcode工程问题总结

文章主要总结了在Unity3d生成Xcode工程的过程中遇到的问题,希望对遇到问题的小伙伴有帮助。

Failed to load package manager

  • 错误描述
    Failed to load package manager
    UnityEditor.HostView:OnGUI()
  • 原因分析
    主要是Unity破解的时候,license使用的不正确。
    例如,下载的Unity版本是5.2.4,但是使用了5.2.3的license。如果在电脑上使用没有问题。但是当打包的时候就会出错。
  • 参考文档
    Failed to load package manager

DXT3 compressed textures are not supported when publishing to iPhone

  • 错误描述
    DXT3 compressed textures are not supported when publishing to iPhone
    Assets/SceneLevel/Model/xuedi/Materials/xd_toushiche.dds
    Included from scene:
    UnityEditor.HostView:OnGUI()
  • 原因分析
    主要是由于Iphone不支持DDS造成的。
  • 参考文档
    • 首先要明白什么是DDS——DDS百度百科
    • 另外可以使用转码工具来对DDS格式的贴图进行转码——转码网站

`xlv_TEXCOORD2’ redeclared

  • 错误描述
    Shader error in ‘Particles/Additive(clipping)’: `xlv_TEXCOORD2’ redeclared at line 80 (on metal)
  • 原因分析
    在shader中进行了重复定义。
    出现此问题的shader为 Particle Add Clipping.shader
    主要问题在于以下代码
    #ifdef SOFTPARTICLES_ON
    float4 projPos : TEXCOORD2;
    #endif
    //------------------add---------------------------------
    float3 vpos:TEXCOORD2;
    //------------------add---------------------------------
    
    主要由于在IOS设备上,支持 SOFTPARTICLES_ON,所以导致了重复定义。

System.Web.Extensions.dll could not be loaded

  • 错误描述

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    Failed running /Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe -out
    Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
    at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
    at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
    at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
    at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
    at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
    at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
    at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
    The following assembly referenced from /Users/r1/Documents/client/Assets/Plugins/System.Web.Extensions.dll could not be loaded:
    Assembly: System.Web(assemblyref_index=2)
    Version:2.0.0.0
    Public Key: b03f5f7f11d50a3a
    The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/Users/r1/Documents/client/Assets/Plugins/).
    Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
    Missing method .ctor in assembly /Users/r1/Documents/client/Assets/Plugins/System.Web.Extensions.dll, type System.Web.UI.WebResourceAttribute
    Can't find custom attr constructor image: /Users/r1/Documents/client/Assets/Plugins/System.Web.Extensions.dll mtoken: 0x0a000011
  • 原因分析
    The following assembly referenced from /Users/r1/Documents/client/Assets/Plugins/System.Web.Extensions.dll
    报错原因是在plugin中有个dll被应用,但是目前不支持web。
    当在编辑器中转换平台之后,就不会报这个错误了。
    也就是并不需要必须将这个System.Web.Extensions.dll 删除

Mono.Cecil.ResolutionException: Failed to resolve System.Web.AspNetHostingPermissionLevel

  • 错误描述
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    Failed running /Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe
    -out "/Users/r1/Documents/client/Temp/StagingArea/Data/Managed/tempStrip"
    -l none -c link
    -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/native_link.xml"
    -f "/Applications/Unity/Unity.app/Contents/Frameworks/il2cpp/LinkerDescriptors"
    -x "/Users/r1/Documents/client/Temp/StagingArea/Data/Managed/../platform_native_link.xml"
    -x "/Users/r1/Documents/client/Temp/StagingArea/Data/methods_pointedto_by_uievents.xml"
    -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/Animation.xml"
    -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/Audio.xml"
    -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/IMGUI.xml"
    -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/Physics.xml"
    -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/Physics2D.xml"
    -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/TextRendering.xml"
    -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/UI.xml"
    -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStrippernk.xml"
    -x "/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/native_link.xml"
    -x "/Users/r1/Documents/client/Assets/Scripts/AStarScriptnk.xml"
    -d "/Users/r1/Documents/client/Temp/StagingArea/Data/Managed"
    -a "/Users/r1/Documents/client/Temp/StagingArea/Data/Managed/Assembly-CSharp-firstpass.dll"
    -a "/Users/r1/Documents/client/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll"
    -a "/Users/r1/Documents/client/Temp/StagingArea/Data/Managed/Assembly-UnityScript-firstpass.dll"
    -a "/Users/r1/Documents/client/Temp/StagingArea/Data/Managed/Assembly-UnityScript.dll"
    -a "/Users/r1/Documents/client/Temp/StagingArea/Data/Managed/UnityEngine.UI.dll"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
stdout:
SweepReport:
System.MonoType => Mono.Cecil.TypeDefinitionMono.Cecil.TypeDefinitionMono.Cecil.TypeDefinitionMono.Cecil.TypeDefinitionMono.Cecil.TypeDefinition
Mono.Cecil.MethodDefinition => System.Boolean System.EnterpriseServices.IConfigurationAttribute.AfterSaveChanges(System.Collections.Hashtable)System.Boolean System.EnterpriseServices.IConfigurationAttribute.Apply(System.Collections.Hashtable)System.Boolean System.EnterpriseServices.IConfigurationAttribute.IsValidTarget(System.String)System.Guid get_Value()System.Boolean System.EnterpriseServices.IConfigurationAttribute.AfterSaveChanges(System.Collections.Hashtable)
Mono.Cecil.FieldDefinition => System.String LiteralFalseSystem.String LiteralTrueSystem.String LiteralNullSystem.String LiteralUndefinedSystem.String LiteralNotANumber
Fatal error in Mono CIL Linker
Mono.Cecil.ResolutionException: Failed to resolve System.Web.AspNetHostingPermissionLevel
at Mono.Cecil.Mixin.CheckedResolve (Mono.Cecil.TypeReference self) [0x00000] in <filename unknown>:0
at Mono.Cecil.SignatureReader.ReadCustomAttributeEnum (Mono.Cecil.TypeReference enum_type) [0x00000] in <filename unknown>:0
at Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue (Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0
at Mono.Cecil.SignatureReader.ReadCustomAttributeElement (Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0
at Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument (Mono.Cecil.TypeReference type) [0x00000] in <filename unknown>:0
at Mono.Cecil.SignatureReader.ReadCustomAttributeNamedArgument (Mono.Collections.Generic.Collection`1& fields, Mono.Collections.Generic.Collection`1& properties) [0x00000] in <filename unknown>:0
at Mono.Cecil.SignatureReader.ReadCustomAttributeNamedArguments (UInt16 count, Mono.Collections.Generic.Collection`1& fields, Mono.Collections.Generic.Collection`1& properties) [0x00000] in <filename unknown>:0
at Mono.Cecil.SignatureReader.ReadSecurityAttribute () [0x00000] in <filename unknown>:0
at Mono.Cecil.MetadataReader.ReadSecurityDeclarationSignature (Mono.Cecil.SecurityDeclaration declaration) [0x00000] in <filename unknown>:0
at Mono.Cecil.SecurityDeclaration.<Resolve>b__2 (Mono.Cecil.SecurityDeclaration declaration, Mono.Cecil.MetadataReader reader) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.Read[SecurityDeclaration,SecurityDeclaration] (Mono.Cecil.SecurityDeclaration item, System.Func`3 read) [0x00000] in <filename unknown>:0
at Mono.Cecil.SecurityDeclaration.Resolve () [0x00000] in <filename unknown>:0
at Mono.Cecil.SecurityDeclaration.get_SecurityAttributes () [0x00000] in <filename unknown>:0
at Mono.Cecil.ImmediateModuleReader.ReadSecurityDeclarations (ISecurityDeclarationProvider provider) [0x00000] in <filename unknown>:0
at Mono.Cecil.ImmediateModuleReader.ReadType (Mono.Cecil.TypeDefinition type) [0x00000] in <filename unknown>:0
at Mono.Cecil.ImmediateModuleReader.ReadTypes (Mono.Collections.Generic.Collection`1 types) [0x00000] in <filename unknown>:0
at Mono.Cecil.ImmediateModuleReader.ReadModule (Mono.Cecil.ModuleDefinition module) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleWriter.WriteModuleTo (Mono.Cecil.ModuleDefinition module, System.IO.Stream stream, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.Write (System.IO.Stream stream, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.AssemblyDefinition.Write (System.String fileName, Mono.Cecil.WriterParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Linker.Steps.OutputStep.OutputAssembly (Mono.Cecil.AssemblyDefinition assembly) [0x00000] in <filename unknown>:0
at Mono.Linker.Steps.OutputStep.ProcessAssembly (Mono.Cecil.AssemblyDefinition assembly) [0x00000] in <filename unknown>:0
at Mono.Linker.Steps.BaseStep.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0
at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0
at Mono.Linker.Driver.Run () [0x00000] in <filename unknown>:0
at Mono.Linker.Driver.RunDriverWithErrorHandling (Mono.Linker.Driver driver) [0x00000] in <filename unknown>:0
at Mono.Linker.Driver.RunDriver (Mono.Linker.Driver driver) [0x00000] in <filename unknown>:0
stderr:

UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:68)
UnityEditorInternal.AssemblyStripper:RunAssemblyLinker(IEnumerable`1, String&, String&, String, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:199)
UnityEditorInternal.AssemblyStripper:StripAssembliesTo(String, String, String&, String&, String, String, IEnumerable`1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:192)
UnityEditorInternal.AssemblyStripper:Strip(String, String, String&, String&, String, String, IEnumerable`1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:143)
UnityEditorInternal.AssemblyStripper:Strip(String[], String[], String, String, String&, String&, String, String, IEnumerable`1) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:123)
UnityEditorInternal.IL2CPPBuilder:RunAssemblyStripper(IEnumerable, String, String[], String[], String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:465)
UnityEditorInternal.IL2CPPBuilder:StripAssemblies(IEnumerable`1, String) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:438)
UnityEditorInternal.IL2CPPBuilder:Run() (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:299)
UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, String, IIl2CppPlatformProvider, Action`1, RuntimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:218)
UnityEditor.PostprocessBuildPlayer:Postprocess(BuildTarget, String, String, String, Int32, Int32, String, String, BuildOptions, RuntimeClassRegistry)
  • 原因分析

    • 主要问题在于“Mono.Cecil.ResolutionException: Failed to resolve System.Web.AspNetHostingPermissionLevel”
      这个问题在于,程序中需要用到“System.Web.AspNetHostingPermissionLevel” 这个类,但是当前的Spripting Backend 与 Stripping Level 决定了这个类会被剥离。
      那我们要做的就是要对其进行保护,在编译成C++的时候,不对他进行剥离操作。
      所以在我们link.xml中设置对其进行保护。
    • 为什么IOS要这么设置呢?
      在android平台下,Spripting Backend设置为Mono2x,Stripping Level设置为Disable,Api Compatiblity Level设置为.NET 2.0。也就是说android平台下使用了整个.NET2.0框架中的类,并且没有做任何剥离操作。
      但是在ios平台下,Spripting Backend设置为IL2CPP,这种编译形式相当于Stripping Level设置为Strip Byte Code。这种剥离等级下,就会将“System.Web.AspNetHostingPermissionLevel”进行剥离,所以我们要在link.xml中对其进行保护。
  • 参考文档

IOS贴图解决

  • 问题描述
    打包iOS之后,多个图集中的图片错位,显示模糊。
  • 原因分析
    说明一:
    首先IOS压缩的方式为 RGBA Compressed PVRET 4 bits。但是前提要求是压缩的图集的宽高比是1,也就是为正方形。
    “纹理在导入时将被缩放到最近的幂大小。例如257x511纹理将成为256x512。请注意,PVRTC格式要求纹理是正方形(宽度与高度相等),因此最终大小将变换到512x512。 PVRTC是一种有损的纹理压缩技术,主要用于iPhone,iPod touch和iPad。”
    所以如果要使用PVRET压缩方式的话,只能将图集打成正方形的。
    在iOS平台下,默认的压缩格式也是这个格式。
    说明二:
    当使用 RGBA Compressed PVRET 4 bits 压缩方式的话,会发现图片失真。
    最优的解决方案是出将一张图拆分为两张图,一张只带有RGB信息,一张带有alpha通道信息。
    因为带有alpha通道的这张图包含的信息较少,所以可以将这张图进行压缩。这样既能够减少包体大小,也能够减少占用的内存。
    说明三
    现在android平台下用到的压缩格式为 RGBA Compressed ETC2 8 bits
    如果单纯带有纯透明的通道的图片,可以选择 RGB + 1-bit Alpha Compressed ETC2 4 bits
    这种压缩模式能够让图片的大小缩小一半。
  • 参考文档

there are no graphs in the scene

  • 问题描述

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    Caught exception while deserializing data.
    System.MissingMethodException: Method not found: 'Default constructor not found...ctor() of System.ComponentModel.UInt32Converter'.
    at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in :0
    at System.Activator.CreateInstance (System.Type type) [0x00000] in :0
    at System.ComponentModel.TypeDescriptor.GetConverter (System.Type type) [0x00000] in :0
    at Pathfinding.Serialization.JsonFx.TypeCoercionUtility.CoerceType (System.Type targetType, System.Object value) [0x00000] in :0
    at Pathfinding.Serialization.JsonFx.JsonReader.ReadNumber (System.Type expectedType) [0x00000] in :0
    at Pathfinding.Serialization.JsonFx.JsonReader.Read (System.Type expectedType, Boolean typeIsHint) [0x00000] in :0
    at Pathfinding.Serialization.JsonFx.JsonReader.PopulateObject (System.Object& result, System.Type objectType, System.Collections.Generic.Dictionary`2 memberMap, System.Type genericDictionaryType) [0x00000] in :0
    at Pathfinding.Serialization.JsonFx.JsonReader.PopulateObject (System.Object& obj) [0x00000] in :0
    at Pathfinding.Serialization.JsonFx.JsonReader.PopulateObject[NavGraph] (Pathfinding.NavGraph& obj) [0x00000] in :0
    at Pathfinding.Serialization.AstarSerializer.DeserializeGraphs () [0x00000] in :0
    at Pathfinding.AstarData.DeserializeGraphsPart (Pathfinding.Serialization.AstarSerializer sr) [0x00000] in :0
    at Pathfinding.AstarData.DeserializeGraphs (System.Byte[] bytes) [0x00000] in :0
    (Filename: /Applications/buildAgent/work/aeedb04a1292f85a/artifacts/iPhonePlayer-armv7Generated/UnityEngineDebug.cpp Line: 49)
  • 原因分析
    “System.ComponentModel.UInt32Converter”在ios当前的编译方式与打包等级的情况下,被剥离了。所以也要在link.xml中对其进行保护

  • 参考文档
文章目录
  1. 1. Failed to load package manager
  2. 2. DXT3 compressed textures are not supported when publishing to iPhone
  3. 3. `xlv_TEXCOORD2’ redeclared
  4. 4. System.Web.Extensions.dll could not be loaded
  5. 5. Mono.Cecil.ResolutionException: Failed to resolve System.Web.AspNetHostingPermissionLevel
  6. 6. IOS贴图解决
  7. 7. there are no graphs in the scene
,