- Home /
buttons don't work if I use int
 int yBody = 0;
 void OnGUI(){
     yBody = 0;
     InvWindow =GUI.Window (0, InvWindow, InvFunc, "inventory");
 }
 void InvFunc(int windowID){
     if (GUI.Button (new Rect (150, 50, 20, 20), "-") ) {//this one works
         Debug.Log("x is 150");
         bodyBut[(byte)body.torso] = !bodyBut[(byte)body.torso]; 
     }
if I write yBody for anything else like 100 it works
     if (GUI.Button (new Rect (80, yBody, 20, 20), "-") ) {//this one don't work any more
         Debug.Log("x is 80");
         bodyBut[(byte)body.torso] = !bodyBut[(byte)body.torso];
     }
so the question is how do I write more buttons like here the yBody is changing for each button, ...
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by MilitaryG · Jul 08, 2021 at 09:48 AM
got it I had change yBody in the InvFunc
 void InvFunc(int windowID){
     yBody = 0;
     if (GUI.Button (new Rect (150, 50, 20, 20), "-") ) {//this one works
          Debug.Log("x is 150");
          bodyBut[(byte)body.torso] = !bodyBut[(byte)body.torso]; 
     }
 }
than it works don't know why but it does work, ... I'd like to know why it doesn't work if anyone can explain please
Your answer
 
 
             Follow this Question
Related Questions
How do I register or read multiple MouseDown events ? 2 Answers
Making a button desplay after pressing a button? 2 Answers
C# Why Won't My GUI Layout Button Appear? 1 Answer
"Organic" GUI Layout C# 3 Answers
UI button doesn't appear - c# 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                