|
First of all sorry for posting the whole code here but if there is a chance that anyone of you would like to improve it overall may it be so. Now on to my problem. The thing is that the toggle buttons wont toggle and their values are always set to zero (the togglewata and togglebloom ones) so here is the code
(comments are locked)
|
|
Personally, I think it's better to store the toggle values in a separate array. If you don't mind coding it that way, here's another Answer that has full code: How can I setup a series of toggle buttons? And another thing I noticed, is that you're not giving the saved toggle value to the Toggle button code (again, see the other Answer for an example of how it's done), so the button will never change. You have to tell the Toggle function, what value to use every time you call it. For example, I think this should do it (haven't tested it):
Update: minor point, but to follow good naming practices, I'd rename the Booleans, as above for example, to hasX. aha and should i replace togglewata with optionsobject.GetComponent("togglewaterbool") because thats where i want to store my values
Jun 07 '10 at 02:12 PM
yosss
okay your code needed a little tweaking and it was good to go thanks a lot
Jun 07 '10 at 02:18 PM
yosss
@yosss, hm, yeah, I didn't really think about it, but you do have two Booleans that are almost identical, you really only need one per value. And no, there shouldn't be a GetComponent at all - just use the Boolean value in the Toggle call, and assign the return value back to the Boolean.
Jun 07 '10 at 02:32 PM
Cyclops
(comments are locked)
|
