- Home /
Drawing a button below a GameObject
I am trying to have two buttons below a gameobject. From what I see using OnGUI would be helpful but Unity advises against it.
The IMGUI system is not generally intended to be used for normal in-game user interfaces that players might use and interact with
My game is in 3d and I want the buttons to be on top of everything else within the game but right below the gameobject. (the gameobject can be in any position). The camera is movable, rotatable and scalable during gameplay so the buttons should always stay under the building and if the building goes out of frame it should too.
What is the best way to achive this? Is using sprites a good idea (with onmousedown and onmouseup functions. the platform I am targetting is both mobile and pc)?
Answer by toddisarockstar · Mar 31, 2017 at 10:26 PM
Thanks :) I really need to get used to Unity's functions.
Answer by xAdamQ · Apr 02, 2017 at 10:07 AM
You just need camera canvas then you can set the position like GO poz + distance.