I’m trying to create a simple simple drop down menu options system. What I want is when you right click on an object, a drop down menu appears, but anchored to the object, so if the camera moves, the menu stays with the object wherever you clicked. Is this possible with OnGUI or do I need to create a 3d menu object?
Pass the position of the object (or wherever you’d like the menu to appear) to Camera.main.WorldToScreenPoint() and use the returned Vector3 (in screen coordinates – convert to GUI coordinates if you’re using OnGUI()) as the relative position of the GUIElement or OnGUI method representing your menu. Of course, you have to keep calling Camera.main.WorldToScreenPoint() whenever your camera moves (or during Update()).
Maybe it’s a stupid answer, but if you want such a features it’s much easier to buy EzGUI plugin - it is very functional and fast solution.
Possibly use a tooltip, usually these are used when you click a button and than a text shows saying whatever you want but you can most likely get this to work with a gameobject.
See where you can get with that