Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to toggle AR Placement Interactable?

Discussion in 'XR Interaction Toolkit and Input' started by ROBYER1, Sep 29, 2020.

  1. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    Using the XR Interaction Toolkit Samples from here for AR : https://github.com/Unity-Technologies/XR-Interaction-Toolkit-Examples

    How do I toggle on/off the placement of AR Placement Interactables using the AR placement Interactable component? For example, I want to be able to tap to add a gameobject on a plane, then not keep adding any more gameobjects after then. Seems so simple but there isn't a tip on how to turn it off, I tried turning off the gameobject with the Placement component on it when I place the first object but I can still keep placing objects!
     
  2. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    This is all I found, a video on how to make my own Placement Component to work around the issue, it would be nice to have a 'placed object limit' value or something
     
    playfulsystems likes this.
  3. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    I also got around it by setting the AR placeable prefab gameobject to 'null' on object place.
     
    elvis-satta and antopravin102 like this.
  4. ACWesterberg

    ACWesterberg

    Joined:
    Oct 21, 2018
    Posts:
    11
    I'd suggest overriding the functionality you need from AR Placement Interactable. And simply add an if-statement to see wether the prefab has been placed or not.
    I've found that approach has been the best practice when it comes to the XR Interaction toolkit code