i am new to unity my probelm is i am using a gui.toggle button named as MALE and FEMALE my need is when i select Male button male texture should display when i click FEMALE button female texture should display. But toggle button is not working properly .I have used renderer as cube
(comments are locked)
|
|
Design3.com is right, don't use 2 variables for the same inforamtion. use this with the example code from Design3
or what would be better in such a case, use a ToolBar.
To make a vertical toolbar use a SelectionGrid with xCount = 1 what is the use of !GUI IN this can u please explain i an new to unity your answer worked correctly thanks a lot
Feb 09 '11 at 06:44 PM
robert 1
The ! is the logical NOT operator. That means when the Toggle function returns true the ! change it to false and when it returns false it gets true. That's nothing special in Unity that's basic programming and works in almost all languages that way. The ! is always the not-operator in all c-style languages like C,C++,C#,Java,Javascript, ... and much more. Here is a page that explain some operators in JS, but watchout, that page talk about JS in webpages. http://www.w3schools.com/JS/js_comparisons.asp
Feb 09 '11 at 07:05 PM
Bunny83
(comments are locked)
|
|
I think you need to use one toggle instead of two. As it is, you have four potential combinations: male TRUE, female TRUE; male FALSE, female FALSE; male TRUE, female FALSE; and male FALSE, female TRUE. Use one toggle ("genderToggle") and:
Also your GUI code has some errors. It should be:
By using "toggleMale" instead of "togglemale", you declared a new variable instead of referring to the variable you declared at the top of the script.
(comments are locked)
|

any answer for this problem