U3D包大小优化之microlib
當邇想把最小類庫發上來,邇需要把Stripping Level設置為Use micro mscorlib
這里是MICROLIB所能使用的包的類庫列表:http://docs.unity3d.com/410/Documentation/ScriptReference/MonoCompatibility.html
?
?
但如果邇不想手動去對著這個列表,邇可以從U3D編譯器查看相應提示信息,邇便可以通過提示而找出是哪些代碼出錯了。
1、最先做的應該是檢測DLL庫,可以空建一個項目,把需要檢查的包打進去,然后使用use micro mscorlib來編譯,報錯的話邇就只能把相應DLL刪除或者替換了。
2、然后便是檢測代碼是否含有部分未被允許使用的代碼了,
UnityException: Failed assemblies stripper: /Applications/Unity4.3.4/Unity.app/Contents/Frameworks/Mono/bin/mono "/Applications/Unity4.3.4/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/UnusedBytecodeStripper.exe" -l none -c link -a "Assembly-CSharp-firstpass.dll" -a "Assembly-CSharp.dll" -a "Assembly-UnityScript.dll" -out output -x "/Applications/Unity4.3.4/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/link.xml" -d "Temp/StagingArea/Data/Managed" -x "tmplink.xml" current dir : Temp/StagingArea/Data/Managedresult file exists: False stdout: stderr: Unhandled Exception: Mono.Linker.ResolutionException: Can not resolve reference: System.Void System.Security.SecurityException::.ctor(System.String) at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference, System.Object markedby) [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.MarkInstruction (Mono.Cecil.Cil.Instruction instruction, Mono.Cecil.MethodDefinition markedby) [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.MarkMethodBody (Mono.Cecil.Cil.MethodBody body) [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.ProcessQueue () [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.Process () [0x00000] in <filename unknown>:0 at Mono.Linker.Steps.MarkStep.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 UnusedBytecodeStripper.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 UnityEditor.MonoProcessUtility.RunMonoProcess (System.Diagnostics.Process process, System.String name, System.String resultingFile) UnityEditor.MonoAssemblyStripping.MonoLink (BuildTarget buildTarget, System.String managedLibrariesDirectory, System.String[] input, System.String[] allAssemblies, UnityEditor.RuntimeClassRegistry usedClasses) UnityEditor.HostView:OnGUI()如果打包時發現錯誤,邇可以查看stderr那一行,這一句Can not resolve reference: System.Void System.Security.SecurityException便是指明了有哪些由于microlib未有包含而報錯的。運氣好的話邇直接搜索源代碼哪里調用這句便可以知道是哪里出問題了,如果運氣不好的話像這個SecurityException,便會是其它的方法引發這個錯誤,比如是Socket.Connect的方法,這種情況只能通過報錯的類型去用排除法推斷是哪里出了問題了。
轉載于:https://www.cnblogs.com/klobohyz/p/3896779.html
總結
以上是生活随笔為你收集整理的U3D包大小优化之microlib的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: WampServer修改MySQL密码的
- 下一篇: 通过TCP/IP连接Mysql数据库