- Home /
Question by
luciferzsw · Mar 08, 2017 at 02:54 PM ·
androidil2cppassembly
Assembly.GetExecutingAssembly doesn't work correctly on Android when use IL2CPP
Assembly assembly = Assembly.GetExecutingAssembly();
Debug.LogError("assembly:" + assembly.FullName);
These C# code print without il2cpp:
iOS:
assembly:Assembly-CSharp, Version=0.0.0.0, Culture=, PublicKeyToken=null
Android:
assembly:Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
but, when I use il2cpp to build an apk or ipa, it prints:
iOS:
assembly:Assembly-CSharp, Version=0.0.0.0, Culture=, PublicKeyToken=null
Android:
assembly:mscorlib, Version=2.0.5, Culture=, PublicKeyToken=7cec85d7bea7798e
Why it prints different result on Android. Thanks for your answer and sorry for my poor English.
Comment
Answer by JoshPeterson · Mar 09, 2017 at 01:05 PM
Which version of Unity are you using? The implementation of Assembly.GetExecutingAssembly()
depends on stack trace support to walk the managed stack trace. Some of the first supported versions of IL2CPP for Android did not have stack trace support.
All of the more recent versions of Unity do have proper support though, so I would expect this to work.