Search Unity

Disable / Destroy Planes not working correctly.

Discussion in 'AR' started by Griffo, Sep 17, 2019.

  1. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi,

    I start detecting planes, all fine, then if I want to disable them I use.

    Code (CSharp):
    1.         foreach (ARPlane plane in arPlaneManager.trackables)
    2.         {
    3.             plane.gameObject.SetActive(false);
    4.         }
    But what I've found is the AR won't detect another plane where there was one and now is disabled.

    I've also tried destroying them like so.

    Code (CSharp):
    1.         arPlaneManager.enabled = false;
    2.  
    3.         foreach (ARPlane plane in arPlaneManager.trackables)
    4.         {
    5.             Destroy(plane.gameObject);
    6.         }
    7.  
    8.         arPlaneManager.enabled = true;
    But again the same problem, if i generate a plane on a table top then use the above code the AR won't detect another plane on the table.

    I've also used.

    Code (CSharp):
    1. arSession.Reset();
    But this leaves the planes behind, tried destroying them before and after a Reset() but still getting same results.

    AR Foundation 2.1.3
    Unity 2019.2.4f1

    Any help Guys & Girls would be gratefully appreciated.
     
    Last edited: Sep 17, 2019
  2. orgelvarg

    orgelvarg

    Joined:
    May 27, 2019
    Posts:
    15