A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'AR' started by nathansisler, Aug 6, 2018.
Just looking for the best/easiest way to do this?
The small documentation that there is says: "The generated GameObjects are parented to a special GameObject under the ARSessionOrigin, accessible via ARSessionOrigin.trackablesParent."
So You could foreach through the children game objects of ARSessionOrigin.trackablesParent and either set the gameobjects inactive or disable their visualizer component.
That, or iterate over the planes in ARPlaneManger.GetAllPlanes and disable the ARPointCloudManager.pointCloud
Please, can you offer the code you are suggesting? I tried this without success:
ARPlaneManager aRPlaneManager = GetComponent<ARPlaneManager>();
aRPlaneManager.enabled = false;
ARPlane planesToRemove = FindObjectsOfType<ARPlane>();
foreach (ARPlane plane in planesToRemove)
It is called by a button once the plane is visible. What I'm doing wrong?
You are only destroying the ARPlane component and leaving the render components. You probably mean to destroy the plane.gameObject.
You don't need to use FindObjectsOfType<ARPlane>() -- The GetAllPlanes method I mentioned will give them to you without doing any expensive scene traversal.
Hi. I have some plane artifacts left over when I switch to non-AR. I use the following code to disable planes:
_ARPlaneManager.enabled = false;
foreach (ARPlane pl in aRPlanes)
if (pl != null)
The problem with GetAllPlanes is that it's a void method. If I want it the planes I would have to update that method by hand or create a new version that returns me the List of Planes. I don't mind to do the code, it's easy, but I don't like to do it considering that in very short time (I hope so), we'll going to have an update which will force us to make the fix again. Unless I'm mistaking the GetAllPlane's method. Please, let me know if I'm wrong.
Hi guys. I found the solution thanks to other @Edur-Games . Here's what he proposed:
planeManager = GetComponent<ARPlaneManager>();
List<ARPlane> allPlanes = new List<ARPlane>();
planeManager.enabled = false;
foreach (ARPlane plane in allPlanes)
I understood wrong the use of GetAllPlanes. I tried this and worked perfectly. I dare to recommend to Unity to Add this simple and very necessary function somewhere. A lot of people need this.
Thanks to all of you.
I am using 2019.1 with ARFoundation Version 2.2.0 And when I use the GetAllPlanes Method, I receive this error:
error CS1061: 'ARPlaneManager' does not contain a definition for 'GetAllPlanes' and no accessible extension method 'GetAllPlanes' accepting a first argument of type 'ARPlaneManager' could be found (are you missing a using directive or an assembly reference?)
I assume the method no longer exists, despite showing up in the ARFoundaiton documentation? Or perhaps I am completely missing something. Any help is greatly appreciated!