- Home /
Disable click-through.
Hi! I have this following codes
var toggleGUI : boolean;
var page: float;
var asd: String = "";
var mov: String = "";
var oimg: Texture;
var nimg: Texture;
var scrollPosition : Vector2;
function Start(){
}
function OnMouseDown () {
toggleGUI = true;
}
function OnGUI (){
if (toggleGUI) {
GUI.Box(new Rect(50,50,Screen.width/2+250,Screen.height/2+200), "Choose one");
if(GUI.Button(new Rect(51,70,120,50), "Text Information")){
page = 1;
}
if(GUI.Button(new Rect(180,70, 100, 50), "Video")){
page = 2;
}
if(GUI.Button(new Rect(290,70, 100, 50), "Images")){
page = 3;
}
if(GUI.Button(new Rect(Screen.width/2+200,70,100,50), "X")){
page=0;
toggleGUI=false;
}
if(page == 1){
scrollPosition = GUI.BeginScrollView (Rect(60,150,625,300),
scrollPosition, Rect (60, 150, 605, Screen.height+200));
GUI.TextArea(new Rect(60, 150, 605, Screen.height+200), asd);
GUI.EndScrollView();
}
if(page == 2){
if(GUI.Button(new Rect(60,150,100,40), "Play Movie")){
Handheld.PlayFullScreenMovie (mov, Color.black, FullScreenMovieControlMode.CancelOnInput);
}
}
if(page == 3){
if(GUI.Button(new Rect(60,150,100,40), "Old Image")){
page = 3.1;
}
if(GUI.Button(new Rect(180,150,100,40), "New Image")){
page = 3.2;
}
}
if(page==3.1){
GUI.Label(new Rect(60,150,Screen.width/2+200,Screen.width/8+200), oimg);
}
if(page==3.2){
GUI.Label(new Rect(60,150,Screen.width/2+200,Screen.width/8+200), nimg);
}
}
}
and I am also familiar with the GUIUtility.hotControl. However, when I try to insert it to my codes above, the GUI's cannot be used anymore once the toggleGUI becomes true. Any ideas on how/where should I put it in the codes above? Thanks in advance!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613163905im_/https://answers.unity.com/themes/thub/images/avi.jpg)