0

I should note that this is an augmented reality project. Application works perfect with Mono2x. Changed to IL2CPP because app store requires 64-bit. Splash screen still plays, but now when the camera tries to start, the app crashes.

I am instantiating objects which represent the player's score. This works perfectly with Mono2X. I also have a very simple collision which worked fine before too.

I get very vague errors like this:

ArgumentException: The thing you want to instantiate is null.
at UnityEngine.AssetBundle.LoadAsset_Internal (System.String name,  
System.Type type) [0x00000] in <filename unknown>:0
at UnityEngine.Object.Instantiate (UnityEngine.Object original)   
[0x00000] in <filename unknown>:0 
at UnityEngine.Object.Instantiate (UnityEngine.Object original) 
[0x00000] in <filename unknown>:0 
at ScoreHandler.OnCollisionEnter (UnityEngine.Collision col) [0x00000]     
in <filename unknown>:0 

(Filename: currently not available on il2cpp Line: -1)

Unhandled Exception: System.ArgumentException: The thing you want to    
instantiate is null.
at UnityEngine.AssetBundle.LoadAsset_Internal (System.String name,  
System.Type type) [0x00000] in <filename unknown>:0
at UnityEngine.Object.Instantiate (UnityEngine.Object original) 
[0x00000] in <filename unknown>:0 
at UnityEngine.Object.Instantiate (UnityEngine.Object original) 
[0x00000] in <filename unknown>:0 
at ScoreHandler.OnCollisionEnter (UnityEngine.Collision col) [0x00000]  
in <filename unknown>:0 

I also get an error on loading the ARMarker. The marker successfully loads anyways though.

ARController (native): [error]Loading single AR marker from buffer,   
width 55.000000.
ARController (native): [error]ARController::addMarker(): called
ARController (native): ARController::addMarker(): Added marker (UID=0), 
total markers loaded: 1, exiting, returning true
ARController: Starting AR.

I'm more concerned with the ArgumentException which is causing the program to crash.

  • You'll likely need to track down what is incorrectly null here. My guess is that something loaded via an asset bundle is being incorrectly stripped, as IL2CPP uses more aggressive managed code stripping than Mono does. You may be able to determine what is missing by debugging a bit, with `Debug.Log` statements or with Xcode (details here: http://blogs.unity3d.com/2015/05/20/il2cpp-internals-debugging-tips-for-generated-code/) – Josh Peterson Jan 04 '16 at 12:27
  • I found out what was null. To start the 8 game objects were already in the collision that gives points so the score was 80. To counteract this I started the score int at -80. When the app started the score read 0. I guess for a very small fraction of a second the score must have been -80 on start, because the fix was to add a "-" object to my resources folder. It needed a "-" object to instantiated or else it gave me the null error. That was a very tricky problem. –  Jan 04 '16 at 12:31

0 Answers0