Quantcast
Channel: Answers for "If I have a button over my 3d world, how can I detect if a mouseClick was in the world or not?"
Viewing all articles
Browse latest Browse all 10

Answer by ben

$
0
0

use events such as mouse position and click count inside GUI button

var gu : GUIText; var aa = 0 ; var aaa : String;

function OnGUI(){

var e : Event = Event.current;
Debug.Log(e.mousePosition);

if(aa==1){

    GUI.Button(Rect(20,100,50,50),aaa);
}

if(GUI.Button(Rect(20,30,100,50),"Button")){

     if(e.mousePosition.x <= 120){

        var ee : int = e.clickCount;        
        var eee : String = ee.ToString();

            aaa = eee;      
            print(eee);
            aa =1;

            gu.guiText.text = eee;

     }

}

}


Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>