Search Unity

Question Unity MARS instantiate object on plane at runtime

Discussion in 'Unity MARS' started by shi_no_gekai, Mar 9, 2021.

  1. shi_no_gekai

    shi_no_gekai

    Joined:
    Mar 3, 2018
    Posts:
    14
    Hello guys,

    I'm new to Unity MARS and there's something I wanted to do but I didn't know how.
    I want to instantiate a random prefab from a list of prefabs to assigned in the inspector at runtime after clicking a button. It's not a tap-to-place. Just a simple button.

    Before deciding to update the project with MARS, I have a scene in which I use the instantiate method for the prefabs, but no with MARS, al tutorials show that for example: I need to create my gameobject the hierarchy under horizontal plane
     
  2. jmunozarUTech

    jmunozarUTech

    Unity Technologies

    Joined:
    Jun 1, 2020
    Posts:
    297
    Hello @shi_no_gekai,

    Correct, A Proxy is a GameObject in a Scene that acts as a stand-in for a real-world object that your app can detect and use, such as a table or a face, etc.

    So to achieve what you want you can just instantiate your prefabs under a proxy; with this, when the proxy is detected, it will appear with all the children prefabs you have instantiated.

    Iif you want you horizontal plane proxies to share your planes make sure you set the exclusivity to shared in the proxy component.
     
    Last edited: Mar 9, 2021