Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Resolved MARS and ARFoundation Versions

Discussion in 'Unity MARS' started by scrant, Jul 21, 2020.

  1. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    66
    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.

    Need to get MARS working in my project. Thanks!
     
  2. jmunozarUTech

    jmunozarUTech

    Unity Technologies

    Joined:
    Jun 1, 2020
    Posts:
    295
  3. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    66
    Hi @jmunozarUTech

    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.

    Any other suggestions?
     
  4. jmunozarUTech

    jmunozarUTech

    Unity Technologies

    Joined:
    Jun 1, 2020
    Posts:
    295
    Which version of Unity are you using?.

    Does the same happens if you create an empty project with ARFoundation, ARCore/Kit and AR Subsystems on 3.1.3?
     
  5. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    66
    Full error thread for the deleted camera object:

    Code (CSharp):
    1. MissingReferenceException: The object of type 'Camera' has been destroyed but you are still trying to access it.
    2. Your script should either check if it is null or you should not destroy the object.
    3. UnityEngine.Camera.get_scene () <0x161fc1ed0 + 0x00062> in <5fd17facc1814c7eab3a17c3c6136f31>:0
    4. Unity.MARS.SimulationView.OnGUI () (at Library/PackageCache/com.unity.mars@1.0.2/Editor/Scripts/Simulation/SimulationView.cs:518)
    5. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    6. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    7. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    8. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
    9. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:381)
    10. UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:375)
    11. UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:351)
    12. UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:406)
    13. UnityEditor.DockArea.OldOnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:395)
    14. UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:293)
    15. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:508)
    16. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:491)
    17. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:484)
    18. UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:477)
    19. UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:449)
    20. UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/IEventDispatchingStrategy.cs:81)
    21. UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/MouseEventDispatchingStrategy.cs:69)
    22. UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:310)
    23. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:275)
    24. UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:238)
    25. UnityEngine.UIElements.EventDispatcher.OpenGate () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:203)
    26. UnityEngine.UIElements.EventDispatcherGate.Dispose () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:44)
    27. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:301)
    28. UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:159)
    29. UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Panel.cs:257)
    30. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.bindings.cs:404)
    31. UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.bindings.cs:194)
    32. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:197)
    33.  
     
  6. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    66
    Using Unity 2019.3.15f1
     
  7. jmunozarUTech

    jmunozarUTech

    Unity Technologies

    Joined:
    Jun 1, 2020
    Posts:
    295
    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?
     

    Attached Files:

  8. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    66
    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.
     
  9. jmunozarUTech

    jmunozarUTech

    Unity Technologies

    Joined:
    Jun 1, 2020
    Posts:
    295
    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?
     
  10. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    66

    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.
     
  11. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    66
    Oh yes, and there is only ever one MARS Session object. Creating that seems to be the problem.
     
  12. mtschoen

    mtschoen

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    182
    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!
     
  13. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    66
    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!
     
  14. mtschoen

    mtschoen

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    182
    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.
     
  15. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    66
    Just DM'd you some files. Thank you!
     
  16. mtschoen

    mtschoen

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    182
    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.
     
    tonialatalo and jmunozarUTech like this.
  17. mtschoen

    mtschoen

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    182
    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.
     
    jmunozarUTech likes this.