Search Unity

2D GUI ovelapping

Discussion in 'Immediate Mode GUI (IMGUI)' started by mjainit, Jun 26, 2011.

  1. mjainit


    Jun 15, 2011
    Hi there,

    I'm developing a game with kinect and unity. For choosing options i want to include hand controlled mouse. So when a person moves his hand then GUI of hand cursor will move accordingly in game environment. I have a question for the unity part.

    If a hand GUI overlaps any option button for more than 3 seconds then i want unity to choose that option. So i want that if a hand cursor GUI overlaps a button more than 3 seconds then that button will be clicked.

    So can you give me an idea how to implement this?
    I'm not asking for a code, Just give me rough idea or a link to appropriate function in scripting manual. or give me a link of anything related to this.

    Thanks in advance :)
    Last edited: Jun 26, 2011
  2. slide


    Feb 2, 2011
    Perhaps you could use a repeat button? Something like this

    public float startTime=0.0f;
    public float endTime=3.0f
    void OnGUI () {
    if (GUI.RepeatButton (new Rect (25, 25, 100, 30), "RepeatButton")) {
    //Enter what you want the button to perform here

    Not sure if this works but could be worth a shot