Loading GUI in middle of mouse and make it work radial

I’m doing a top down game and the idea is that when a player clicks and holds on a object it will present a radial GUI around where the mouse pointer is and the player can choose the options from it (point and click style).

THe way for choosing the options is similar to Maya radial menu where you click and hold, then drag the mouse to the option you want and lift it.

I managed to get the GUI to show where the mouse is when clicking on the object but its always aligned to the top left corner.

Also I have no idea how to disable the mouse from controlling the camera and getting it to control the new UI (and stop the UI from following the mouse for a few secs so you can choose the option).

Here is an example of what I mean as a radial menu:
http://www.youtube.com/watch?v=edp_ZCzBG08&feature=player_detailpage#t=237s

When someone talks about a radial menu i always think of the old second life pie menu or L4D voice menu. I never used Maya ( since i’m a programmer :slight_smile: ), but the menu seems to look way differently than i would imagine a radial menu. Well, it doesn’t actually matter :smiley: but a screenshot of your menu would be a better reference since we can also see what’s the problem.

Ok, now to your menu. The UnityGUI elements are ment as usual gui controls. So a click on a button is only counted when you click down and release on the same button. That’s the normal GUI behaviour in almost all GUIs. In your case you have to test the releases yourself. You could write your own “GUI control”-function (like Button()) but only react to mouse up and ignores the mouse down event.

// C#

bool ReleaseArea(Rect aRect, GUIContent aContent, GUIStyle aStyle)
{
    Event e = Event.current;
    bool isOver = aRect.Contains(e.mousePosition);
    if (e.type == EventType.Repaint)
        aStyle.Draw(aRect,aContent, isOver, true, true, false);
    else if (isOver && e.type == EventType.MouseUp)
        return true;
    return false;
}


void OnGUI()
{
    if (ReleaseArea(new Rect(10,10,200,50), new GUIContent("Button1"), "Button"))
    {
        // mouse was released on this area
    }
}