Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

MeshInstanceRenderer not Rendering on iOS

Discussion in 'Data Oriented Technology Stack' started by Srokaaa, Dec 2, 2018.

  1. Srokaaa

    Srokaaa

    Joined:
    Sep 18, 2018
    Posts:
    110
    I get a following stacktraces whenever I try to run my game on iOS:


    Code (CSharp):
    1. (Filename: currently not available on il2cpp Line: -1)
    2.  
    3. MissingMethodException: Constructor on type 'Unity.Rendering.MeshInstanceRendererSystem' not found.
    4.   at System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) [0x00000] in <00000000000000000000000000000000>:0
    5.   at System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <00000000000000000000000000000000>:0
    6.   at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0
    7.   at Unity.Entities.World.CreateManagerInternal (System.Type type, System.Object[] constructorArguments) [0x00000] in <00000000000000000000000000000000>:0
    8.   at Unity.Entities.World.GetOrCreateManagerInternal (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
    9.   at Unity.Entities.World.GetOrCreateManager[T] () [0x00000] in <00000000000000000000000000000000>:0
    10.   at Systems.Inputs.ArInputSystem.OnUpdate (Unity.Jobs.JobHandle inputDeps) [0x00000] in <00000000000000000000000000000000>:0
    11.   at Unity.Entities.JobComponentSystem.InternalUpdate () [0x00000] in <00000000000000000000000000000000>:0
    12.   at Unity.Entities.ScriptBehaviourManager.Update () [0x00000] in <00000000000000000000000000000000>:0
    13.   at Unity.Entities.ScriptBehaviourUpdateOrder+DummyDelagateWrapper.TriggerUpdate () [0x00000] in <00000000000000000000000000000000>:0
    14.   at UnityEngine.Experimental.LowLevel.PlayerLoopSystem+UpdateFunction.Invoke () [0x00000] in <00000000000000000000000000000000>:0
    When I run it on Android everything works perfectly fine
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    2,174
    It's being stripped due to IL2CPP. If you used IL2CPP on android you'd have the same issue (actually this is why I promote using IL2CPP for android/iOS, it makes it so you have the same issues on both platforms rather than running into 2 separate set of issues you have to deal wtih.)

    Either make a direct reference or setup a link.xml
    https://docs.unity3d.com/Manual/IL2CPP-BytecodeStripping.html

    (This is something I hope Unity addresses and fixes because having to deal with 3rd party libraries being stripped is very annoying.)
     
  3. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,494
    I wonder how to make the constructor not stripped? You have to `new` them all at some point with all possible overloads? (becuase system code is not supposed to be new-ed at any point, using manual world also uses activator for the create instance)

    *also you can use [Preserve] on a per system basis https://docs.unity3d.com/ScriptReference/Scripting.PreserveAttribute.html
     
  4. Srokaaa

    Srokaaa

    Joined:
    Sep 18, 2018
    Posts:
    110
    @tertle @5argon Thank you! That was the cause. I now switched to IL2CPP also on Android to not have any differences between platforms.

    For now I just added this rule to link.xml:
    Code (CSharp):
    1.     <assembly fullname="Unity.Rendering.Hybrid" preserve="all"/>
    2.  
    Is there any way to look up the final classes present after IL2CPP stripping? Professionally I work as an Android dev and we often run into similar issues with proguard there. On Android I am able to easily check what classes are in the final .apk file though
     
unityunity