Hi, the MARS docs say that it recommends ARFoundation version 2.1.8 but that it will work with higher versions. I need to have installed at least v3.1.3 of ARFoundation for other parts of my project to work. However, when these are installed, I get a ton of errors and nothing works in MARS:
UnityException: Transform child out of bounds
Unity.XRTools.Utils.GameObjectUtils.CopyHideFlagsRecursively (UnityEngine.GameObject copyFrom, UnityEngine.GameObject copyTo) (at Library/PackageCache/com.unity.xrtools.utils@1.0.1/Runtime/GameObjectUtils.cs:141)
MissingReferenceException: The object of type 'Camera' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Camera.get_scene () <0x18b825280 + 0x00062> in <5fd17facc1814c7eab3a17c3c6136f31>:0
Unity.MARS.SimulationView.OnGUI () (at Library/PackageCache/com.unity.mars@1.0.2/Editor/Scripts/Simulation/SimulationView.cs:518)
How can I get MARS to work with later versions of ARFoundation? Is there some magical dependency chain? Iâm also using ARKit XR Plugin 3.1.3 and FaceTracking 3.1.3 which wonât work unless they are the same version as ARFoundation it appears.
This doesnât seem to be working. ALL version of ARFoundation, ARKit, ARCore, and ARSubsystems are all set to 3.1.3 and yet⌠MARS completely freaks out. The Sim and Device views empty out and I get the above errors listed dozens to hundreds of times. In addition, the hierarchy has extra nodes added labeled âDELETE ME | temporary root used by SimulatedObjectsManager(Clone)â This happens in the template scenes as well.
Can you please post what does the build settings check says?, Again, do you get the same errors if you create an empty project with ARFoundation, ARCore/Kit and AR Subsystems on 3.1.3?
OK, took me a few to setup a new test scene with all the packages. Sooo⌠a new project does appear to work with those versions. Opening up the old project into a MARS template scene also works. It appears to be the actual scene Iâm trying to work on causing the problem. Anytime a Mars Session is added thatâs when it freaks out. Nothing strange in my scene though. Adding the MarsSession moves the camera under that node and everything seems fine. As soon as I switch to SimView thatâs when it freaks out, everything disappears in SimView, and everything gets put under those DELETE ME nodes in the hierarchy. Everything after that is hosed and need to restart the project.
Hereâs what Build Check says:
Caution! The package dependency version is unsupported: âcom.unity.xr.arfoundation : 2.1.8â; the detected version is âcom.unity.xr.arfoundation : 3.1.3â
Caution! The package dependency version is unsupported: âcom.unity.xr.arkit : 2.1.9â; the detected version is âcom.unity.xr.arkit : 3.1.3â
Caution! The package dependency version is unsupported: âcom.unity.xr.arkit-face-tracking : 1.0.7â; the detected version is âcom.unity.xr.arkit-face-tracking : 3.1.3â
â The following checks were run and reported passed â
The Editor version is a match and is supported: â2019.3.15f1â
Required define symbols were all detected. The checked defines were:
Found : âUNITY_CCUâ
This report was generated using the Elective Extensions config with FriendlyName: âiOSâ
Not sure what that means re versions. I have 3.1.3 installed for each of those.
Excellent, You should only have one MARSSession game object per scene.
If you try to do the same steps that makes your app pop errors on the new scene, do you manage to get the console errors?. If so. could you write us a step by step guide on how to get said errors so I can try here?
So I have my scene which I have been working in which was an ARFoundation scene by the way. So I duplicate that so as not to screw it up into a new scene and unparent the AR Camera and remove the ARSession and ARSession Origin nodes as well as any ARFoundation components on the AR Camera just to be safe. So now its just a regular scene with a Canvas, EventSystem, and scene specific nodes.
Then I go to GameObject menu and add the MARS Session object. It grabs the camera and parents it under itself. All still good. Then I switch to the Simulation View (or Device View) and you can see the environment geo briefly but then it quickly disappears and the console fills up with hundreds of the above errors messages I first posted.
I am using the XRInteraction Toolikit also so there are some of those nodes of the camera but I would obviously assume this shouldnât be a problem?
Thatâs it. Then the scene is hosed and you canât add template scenes or do anything MARS related. Have to quit and reopen.
Hi there! Thanks for trying MARS, and sorry that youâre having difficulty. I tried this kind of setup in a project with AR Foundation 3.1.3 and XR Interaction but wasnât able to reproduce your issue. It sounds like weâll need access to your project in order to reproduce the issue. Are your comfortable sharing it via the bug reporter?
If so, please open the project, go to Help > Report a Bug⌠and fill out the form. Make sure that you do not delete your project folder from the files field at the bottom. If it is a large project it may take a long time to upload. If this is the case, and you are able to do so, please try to replicate the issue in a smaller project and upload that.
Thanks for your patience. Once we are able to reproduce the issue we should be able to get you sorted!
Oh boy. Yeah Iâm not sure I can send the project for obvious security reasons and also because it is enormous with all the assets. Is there ANY other workaround you can think of to get me up and running? New scene, setup MARS, and back in my other assets? Something like that or otherwise? Really need to be up and running. Under deadline and could use the functionality could I get it running. Thanks!
Thatâs understandable. Could you attach the scene file, or create a .unitypackage with the scene and any dependencies that may be necessary/helpful to reproduce the issue? With that and your project manifest (Packages/manifest.json) I may have better luck reproducing your issue. If you want to share it privately, send me a direct message.
For any internet explorers who come across this thread, scrant was able to deduce that scripts from an asset store package that uses [ExecuteInEditMode] to ensure that their object is a root in the scene. This causes exceptions during the process where we copy the scene objects into the simulation scene. We are working on a more permanent fix, but thankfully in this case itâs possible to just hack the asset store script and disable this behavior.
I will update this thread when we have released a fix.
Quick update: This was fixed in MARS 1.1 but I never got around to updating the thread. Objects that unparent themselves using ExecuteInEditMode no longer cause errors, but they will not show up in simulation, and may leak into preview scenes. In general, this behavior should still be avoided.