- Home /
Need figuring out how to return values of original rect size using toggle buttons.Floorplan rec stretches out when RoomViews button toggled open but doesn't collaspe. Have tried researching but no luck.
So I've figured out the code to concentrate on:
bool ToggleButton( bool toggle, string text )
{
if (toggle==false)
windowRect = new Rect (20, 90, 170, 50);
if(GUILayout.Button( text ))
return !toggle;
else
return toggle;
}
I added the windowRect = new Rect (20, 90, 170, 50); line from the private Rect code at the top the attached code file controgui.txt. Doing this has made it so the Floorplan navigation rect does collapse now, but it flickers a lot when doing so.A better to describe is when I click on the Room View button, it's like the whole rect gets small or disapears and then gets big showing all the sub buttons. Then when I click it to close it gets super small then goes back to it's original size. With this set up am I re-initializing the windowRect variable everytime,causing the jumpy movement? Again any help would be much appreciated. Thanks.
Your answer

Follow this Question
Related Questions
playerprefs dont load for menu toggle 0 Answers
Toggle OnValueChanged ignore on start 2 Answers
Toggle bool with keypress -2 Answers
Using an Enum for GUI.Toggle? 1 Answer
How to change a bool value in game? 1 Answer