Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice
  2. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Resolved Remove canvas on TrackingStateCondition

Discussion in 'Unity MARS' started by Ricardotlpz, Jul 14, 2021.

  1. Ricardotlpz

    Ricardotlpz

    Joined:
    May 17, 2021
    Posts:
    47
    Hey! I was diving into the documentation but can't seem to find enough info on how to code the following:

    1. AR session is initialized with a canvas that shows a box to fit an image marker
    2. When the image marker is tracked, remove the box to fit the image marker

    I'm guessing it's fairly simple with something like if(TrackingStateCondition = true), do X, but can't seem to find how to call that specific thing.
     
  2. Jono_Unity

    Jono_Unity

    Unity Technologies

    Joined:
    Apr 5, 2016
    Posts:
    15
    Hey @Ricardotlpz! This is super quick to do using a 'Match Action' on your image marker proxy and doesn't require writing any code. Set up your UI canvas with the marker instructions, and then on the marker proxy, add a 'Match Action', then use the 'Add Event' button in that component to add a 'On Match Acquire' event, connect your canvas, and set the dropdown to GameObject.SetActive, with the checkbox to 'false'. So your proxy will look something like this:
    upload_2021-7-14_14-30-40.png
    Full editor context:
    upload_2021-7-14_14-38-50.png

    You'll see that I've also added a simulated image marker into my simulation scene, so I can test this locally. You can do that using the MARS Panel (Window > MARS > MARS Panel), and pick 'Synthetic Image Marker' there, and make sure to set that marker and your marker condition up to use the same image.

    I attached a package containing the scene+asset I put together for the screenshots.

    Does that do what you're looking for?
     

    Attached Files:

    Ricardotlpz and jmunozarUTech like this.
  3. Ricardotlpz

    Ricardotlpz

    Joined:
    May 17, 2021
    Posts:
    47
    YES! This was exactly what I was looking for! Thank you so much.
     
    Jono_Unity likes this.
  4. Jono_Unity

    Jono_Unity

    Unity Technologies

    Joined:
    Apr 5, 2016
    Posts:
    15
    Awesome, you're welcome, keep it coming!
     
    Ricardotlpz likes this.
unityunity