Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

How to place an object in relation to another

Hello everyone,

I'm still new to Unity and C#, and could use some help with code. I'm currently trying to implement code in my TapToPlace script that displays a menu alongside an object when it is placed, but I do not know what line of code I should be using to accomplish this. I have created a public Canvas variable in my script which takes in the Canvas from my scene. My canvas contains two panels which act as menus, and I am trying to anchor the second menu next to an object after it has been placed (i.e. in the else statement of the OnInputClicked method). How can I anchor the menu on the right of a scene object that has just been placed?

Thanks in advance,


  • ReeleyReeley ✭✭✭

    You could make your canvas a child object of your object you want to place, then it would move with your placable object. i think you can set the parent with transform.parent = yourobject;

    after you have done that you have to position the canvas a little bit to the right of your object

  • BenProtusBenProtus
    edited June 2017

    I should clarify the way my program is set up. I have a collection of different objects with an assigned "currentObject" based on the object that was last manipulated. I'm not sure how I would apply this to make the menu appear next to the current object as it's not possible to have more than one Canvas object in a scene.

  • ReeleyReeley ✭✭✭

    Ok so you know what your current object is, then make your menu a child of your currentobject and place it as you want. if you want the canvas to stop following the object you can unparent your canvas with

    transform.parent = null;

    and then when you manipulate the next object repeat the procedure

    PS: there should be no problem with having more than one canvas in your scene

Sign In or Register to comment.