Reference Exception on Example Scenes after merging Mars with current Project

Hey guys, this is great stuff, I’m looking to add Mars to my current ARFoundation project but it seems something has gone wrong with my current setup and I was hoping you could point me int he right direction.

When playing any of the example scenes in a fresh project, it works fine. When trying in my current project, I get these errors.

NullReferenceException: Object reference not set to an instance of an object
Unity.MARS.Data.IRequiresTraitsMethods.TryGetTraitValue[T] (Unity.MARS.Data.IRequiresTraits`1[T] obj, System.Int32 dataID, System.String traitName, T& value) (at Library/PackageCache/com.unity.mars@1.2.0/Interfaces/Traits/IRequiresTraits.cs:50)
Unity.MARS.Data.Reasoning.GeoDuplicationReasoningAPI.ProcessScene () (at Library/PackageCache/com.unity.mars@1.2.0/Runtime/Scripts/Reasoning APIs/GeoDuplicationReasoningAPI.cs:31)
Unity.MARS.Data.Reasoning.GeoDuplicationReasoningAPI.Setup () (at Library/PackageCache/com.unity.mars@1.2.0/Runtime/Scripts/Reasoning APIs/GeoDuplicationReasoningAPI.cs:24)
Unity.MARS.Data.Reasoning.ReasoningModule.SetupReasoningAPIs () (at Library/PackageCache/com.unity.mars@1.2.0/Runtime/Scripts/Modules/ReasoningModule.cs:167)
Unity.MARS.Data.Reasoning.ReasoningModule.Unity.XRTools.ModuleLoader.IModuleBehaviorCallbacks.OnBehaviorAwake () (at Library/PackageCache/com.unity.mars@1.2.0/Runtime/Scripts/Modules/ReasoningModule.cs:266)
Unity.XRTools.ModuleLoader.ModuleLoaderCore.OnBehaviorAwake () (at Library/PackageCache/com.unity.xrtools.module-loader@1.2.0/Runtime/Scripts/ModuleLoaderCore.cs:580)
UnityEngine.Debug:LogException(Exception)
Unity.XRTools.ModuleLoader.ModuleLoaderCore:OnBehaviorAwake() (at Library/PackageCache/com.unity.xrtools.module-loader@1.2.0/Runtime/Scripts/ModuleLoaderCore.cs:584)
Unity.MARS.MARSSession:Awake() (at Library/PackageCache/com.unity.mars@1.2.0/Runtime/Scripts/MARSSession.cs:128)

Unity Version 2019.4.18f1
ARFoundation Version: 4.1.3
ARKit 4.1.3
Mars: 1.2.0

Thanks, looking forward to adding this to our project.

Interesting; on a hunch, do you use GPS location (Input.location) in your AR Foundation project?

Nope! No location stuff.

Scratch that hunch then…
If you are able to can you file a bug using the bug reporter tool in the Editor? That will help us track this down.

Another hunch: Can you try deleting the Assets/MARS/Generated folder? This will trigger MARS to re-run code generation, which could fix the issue you are seeing. This may result in compile errors, so I recommend that you back up your project first.

I’m not seeing any folder named “Generated” inside the MARS folder. Hopefully this helps in some way. :slight_smile:

Done!

Can you please provide the ticket number or a link to the ticket? You should have gotten an e-mail after submission with this info.

Found the root of this: Another plugin in the project (ReorderableInspector) is stomping on a callback we rely on to trigger our code generation.
This has been fixed in their github repository but they haven’t made a release since then. You can either grab the latest version of their code or edit the one you have, changing Editor/ReorderableArrayInspector.cs:65 from

EditorApplication.delayCall = () => { EditorApplication.delayCall = () => { FORCE_INIT = false; }; };

to

EditorApplication.delayCall += () => { EditorApplication.delayCall = () => { FORCE_INIT = false; }; };

Awesome! Thank you!

1 Like