#π-ar-simulation-bugs
**Please report bugs here**: https://github.com/needle-tools/ar-simulation/issues
Apologies only just seen this, this is perfect! Thanks!
Working on Unity 2020.3.0f1, ARsim 1.2.0prev.4 ArF and other plugins 4.0.12 I get this error on build target Android when doing a build & run to device then trying to hit play right after in Editor
I have to reimport AR Sim everytime or downgrade to a slightly lower version of arsim then update to the latest version everytime to fix
That sounds very weird. So what's the repro steps here - to confirm:
- fresh project on that version
- build & run to Android
- press Play in Editor
- compile error
I will repro in a fresh project tomorrow as busy on this project but this is literally a fresh project I started using it with today and those were the steps
Is it enough to import any script (and thus trigger a domain reload)? Do you have fast domain reloads on, or regular?
I don't have Enter play mode settings on by default as this was a fresh project made with 2020.3.0f1 today, I will try ticking play mode options and reload domain on
That didn't fix it
Importing any script?
That does not fix it either :(
OK thanks! We'll look at it
I will make a repro later today too, tight deadline on an AR app (one day π€£)
Repro project here as promised Just hit build and run with Android build target on 2020.3.0f1, hope you all have a good weekend, I managed to get my app finished just couldn't do too many builds due to needing to reimport ARSim everytime I did https://drive.google.com/file/d/1V8gaIfgv_Q_iZtnKbGWRxpC19ef8gKzH/view?usp=sharing
Thanks for the project <@!103054507105067008> sorry for the inconvenience. Sounds super odd. I'll have a look at it the next few days π€
Probably a bug from 2020.3 I reckon, now I'm on these newer versions with reorderable inspector arrays, I'm not going back lol
haha
<@!103054507105067008> let me know if 1.2.0-preview.5 helps. I built couple more times with it and it seemed to work for me
Thanks will try today
When disabling the AR Session component to stop AR, in the Editor with AR Sim the behaviour is different to in build, in editor, the AR session is always running due to the component being in the scene even if it is disabled, and disabling it doesn't disable AR Sim. Is there something you can do around checking if the AR Session component is enabled or not?
Could you try updating to 1.3.0-pre ? Released today as well π
Two birds with one stone ;) great work <@272528485732450305> and team! This tool has helped me massively so far π
A new fun bug, with the 1.3.0-pre.1 version, when updating something in a script after having play mode on, in a scene where we by script enable/disable the arsession component, ARSim refuses to work after play mode - exit play mode - change something in a script - come back hit play mode and get to the part where we enable AR session component. I will make a repro later
In the same test project I set over probably
Out of curiosity, are you saying this is a new bug in 1.3.0 or may it always have been there? The issue sounds a bit too invasive for us to not notice this while testing
I have rolled back to 1.3.0pre before the.1 version to verify
and its not in 1.3.0 pre ????
I will sort a repro soon as I suss out the minimum criteria for a repro
Please use the same repro from here. Just update AR Sim to 1.3.0-pre.1, hit play mode on the Test scene, exit play mode and then build for android from a windows pc or IOS from a mac then try to hit play mode and simulate AR again
- Unity version the same - 2020.3.0f1
<@!103054507105067008> is the bug that no active XR Loader is found?
thats what im getting
but actually
the weird thing is:
Ooh I had warnings silenced, will look but was the behaviour the same? All I did was take that repro project I sent, upgrade ARSim then do a build first and try to play after
Then ARSim just didn't start
yes Im in your repro with latest ARSim
I investigate
i have a feeling that enabling/disabling in xr plugin management could help but... could that be an xr management bug? not sure
nope, thats not enough
weird
Only workaround I found was downgrade to an earlier preview package then use that, then next time I built I upgraded to the newest package, if that helps. Thanks for looking into this
Something happens to the loaders when we build, but what π
Huh? So you downgraded, worked with that and for build you upgrade?
Maaaaybe I found it... π€ but Im not sure I trust it
Fingers crossed! I was doing lots of builds on a mac and pc so having to downgrade/upgrade after every build added up a lot of time π I appreciate the speedy support
No, just downgrade once after building, to the next version down just so it reimports and fixes the issue. Then next time I buikt, the issue returned of course, so then I upgraded, then I went back/forth doing that to continue working without issues
When importing AR Sim package in new projects on MacOS with unity 2020.3.0f1, it auto chooses package 1.3.0-pre.2 but ARSim doesn't install itself until I open packman and choose a previous package version to downgrade, then everything installs
Also not sure if these are ready to go yet but the simulated environments don't work for me I just get a floor plane underneath the scene. I might just be setting them up wrong maybe but I just dragged one of the environments into the scene then enabled an environment on the Sim AR Environment manager script then hit play
I think if you have a simulated plane generator in your scene already, that basically says "I want that explicit plane, not the environment". Can you try removing the SimulatedPlane and then pressing play?
You either need a SimulatedPlane or GeneratePlane component if you use an ARPlaneManager component
I didn't add any manually but they instantiate at runtime from AR Sim identifying that I have an AR Plane and Pount cloud manager
I tried adding some manually but it still liked to use just that square
Oh I gotcha, add a simulation plane manager in too myself aha
With ARSim 1.3.0-pre.2 on Unity 2020.3.0f1, in Samples - BasicARCameraImage, on enter/end play I always get this error as it seems to be trying to save a prefab in the packages folder:
mmh I'll take a look
Simulated AR Environment Manager - Camera Placement - Use Environment default pose - is that meant to be a pose set for each environment? When I use it, it just places the camera where my scene camera is. Which is what the scene camera option should do. It's happening usually when I am working on UI so the scene camera is miles away and I want to test in editor with play mode, it puts the camera where the scene one is. Random placement works fine but it is very random haha
You might have to define a default pose first. You can do that on GameObject with the SimulatedEnvironment component. Position your scene camera to your liking and then click "Capture camera pose" on the component.
Altough I might need to look at that again, I think this information is stored in the component right now, and that might be a problem when ARS is in an immutable folder actually. Let me know when you tried it
π I tried
Ok thats stupid by me, Ill change it π sorry
If you have 2 cameras in a scene, the Simulated AR Environment Manager likes to change the culling mask on one of them always, this is causing me issues as I have a video streaming app where one camera is parented to the ARCam to rendertexture the view always, only one of the cameras sees the simulated environment in the editor because ARSim seems to untick culling mask 'everything' on one of the cams and always save it as 'mixed' even if I change it myself and save the scene, on reload it changes again
The culling mask on the ARCamera (set in ARSessionOrigin) is set to not render the simulated environment but it should only disable one layer
You are using URP right?
Which does see the environment and which doesnt and how should that be?
Using URP yep! Main camera should see the environment but once it is set by your script on onvalidate, scene change or scene save it changes to such a layer mask that cannot see the simulated environment but the non main camera can see it fine as that one seems to be untouched.
I will try to get a video or screenshots of it tomorrow as my description may be a little vague, sorry!
The main camera should see it? Why? The design here is that the camera is not supposed to see more than what it would on device - and the main cam would not be able to render the real world, only via background image which is what we do as well. I'd even argue your second camera shouldnt see the environment either and that is a bug.
Do you want them to render everything in the main camera for documentation/presentation?
To clarify, your in-game cameras should never render the simulated environment because they wouldn't do on a device. They receive an image of the simulated environment though, similar to how a skybox is just an image of an environment. This means that occlusion etc will work the same as in the real world
I think we could do better there in terms of documentation, but same as Marcel I think it would be great to understand your goal here
I have a camera for the main ui in the app where the user sees the AR feed behind the Ui in that cam with the ARbackground renderer. I have a separate camera that is rendering into an outgoing video feed just the AR session without the UI so the view is doubled. It's a bit of an edge case so I'd probably ignore this issue for now as I have my own workarounds!
I did find a new bug today (sorry!) When you start scene with AR Point Cloud manager component disabled, then enable it, ARSim doesn't detect it but it works fine when you do that with AR Plane Manager. Using Unity 2020.3.0f1 and ARSim 1.3.0pre.3 and ARF 4.1.5
Oops another one (sorry guys!)
In 2020.3.0f1 with ARF 4.1.5 and ARSim 1.3.0-pre.3 I occasionally get this error in the editor. I haven't found the repro case yet but it's hit me 3 days in a row often when just changing scenes between scenes that have ARSim Simulated Environments in and saving a scene or changing a script. Hope this helps?
MissingMethodException: void Needle.XR.ARSimulation.Simulation.SimulatedAREnvironmentManager.UpdateIfChanged()
System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) (at
You can just exclude the environment yourself - just set the culling mask on your second camera, AREnvironmentManager has method (ExcludeEnvironment, takes your current camera culling mask and returns the culling mask that ignored the environment)
Weird, will look into that
you mean when you are switching between different scenes that have the AREnvManager in it and then save?
Yep I seem to be able to repro it doing that or it happens sometime around that process
I will see if I can split my work project off into a repro one for you this week for the Missingmethodexception error as it is happening very regularly today
I noticed in the most recent versions that they cause interference with Unity ondrag and on end drag events - I will send over a repro when I have time as the Game View interaction with AR Sim seems to lock down on start drag and on end drag events with UI. Draggable UI elements we use get stuck to the cursor usually
Hi, I'm currently evaluating the package for buying a couple of seats. I think I've found some bugs (Using ar simulator version 1.3.0-pre.4) or at least issues where I don't know how to achieve desired behaviour.
Hovering any kind of ui will block the right-click Camera movement completely (evaluating ev.IsPointerOverGameObject() leads to true which then returns false for AllowMouseInput, printing "Prevent"). Toggling "Disable Input with Selected UI" does nothing to change this (which might make sense since there is no UI selected).
If I enter playmode with disabled ar components and enable them later, the simulated ar pose provider and the input helper do not get added to the ar camera.
Hello <@456226577798135808> thanks for raising those issues.
UI Gameobject: sounds like a bug, yes. We need to add some more checks to only stop movement input when using scrollviews or dropdown menus. Will fix that in the next update.
What do you mean by "disable ar component" - which components do you disable and enable later?
Hi <@!272528485732450305> , thanks for the quick response. Hmm doing some more testing it seems the first issue also only appears after disabling and enabling the AR components once. AR Components => As I only need ar at very specific points in my app, I disable the AR Session and the AR Session Origin Gameobjects (including all of their usual components and the child ar camera) for the non AR parts of the application (The rest of the application also runs on a different camera as well as a screen overlay ui). Is this approach problematic?
Ah I see. Sounds like the setup code doesnt find the session because the gameobjects are disabled. Let me check
Ah yes, it is not finding the session when disabled and therefor not running at all. I think we can change that to include inactive
Makes sense for the startup, would this also be the reason why it breaks when disabling and reenabling these gameobjects during runtime?
By breaks you mean that you cant move around?
Yes, you can replicate this by dragging a canvas with an invisible fullscreen image (with raycast target) in one of the samples. First you will be able to still move and look around via right click. But if you then disable and reenable the AR Session and Ar Session Origin Gameobjects right click move/rotate stops working - printing the "Prevent" message in the debug log. (also the following message appears each time when enabling the gameobjects but doesn't seem to affect the issue:No active UnityEngine.XR.XRInputSubsystem is available. Please ensure that a valid loader configuration exists in the XR project settings
Yes the dragging/blocking is an issue. I try to fix that
Yup you can ignore this warning, it has no effect π to get rid of it we would need to write a native plugin, but without any real gain, just potential issues.
Ok, good to know. I'll ignore the warning. Looking forward to the fix and thx again for the quick response. π
<@456226577798135808> Gosh, sorry. Didnt run tests yesterday. Ok, what if we expose a method that you can call once when you switch to AR mode once (and your gameobjects are all active) ?
That would work. I could put some #if editor clauses around that. Would that approach clash with your goal of ar simulation "not leaving a mark on the project" (freely paraphrased by me)?
I think if we also use an editor directive around the method and forcing you to do that as well it should be fine
Makes sense. Sounds like a good way to give 2019 "dynamic setup capabilities" π
I might have a better solution for you π
<@456226577798135808> can you try 1.3.0-pre.6 ? You shouldnt need to change anything.
I'm Intrigued, let me check
I see what you did there, works perfectly, thank you π One thing I noticed though, After reenabling the AR Gameobjects I need to deselect the device simulator window once (by for example selecting the hierarchy window) and then select it again bevor the right click camera movement works.
Great! Mmmh ok sounds a bit annoying. Can't look into that right now tho but will look at it next time π
Is the other issue with not being able to move with UI also better?
Yes, that did disappear alongside the other issue. Probably was connected to the disabling/reenabling. Thank you again, License bought and assigned, I think this simulator will save me lots of time from now on π
Cool thanks! Glad it helped/helps π
<@456226577798135808> would be great if you leave a review at some point - thanks! And please let us know if you run into any other issues!