|
Got a fun one for ya guys this time. I have a simple script attached to my gameobject. It works perfectly and all, but the problem is that if I save the scene, with the script currently attached to my gameobject, then when I turn Unity back on, the script will no longer work. If I attach it to any new game object it will work, or if I save Unity without the script attached, close it, restart it and reapply the script, the gameobject will then work correctly. But if I save and close Unity with the script on, no matter what I do when I re open it, besides closing it with the script unattached, will make the gameobject work. Below is the quick code(so if theres a typo my apologies it is correct on my project), and any solutions to this problem would be greatly appreciated. This script is the only one that causes this problem, and it does not matter which gameobject it is attached to, they all error the same way. The button is still on the screen, it just does not function with whatever I put inside the brackets.
Thank You for your help
(comments are locked)
|

what OS do you have?
Separate the GUI from the scripted object and have the button address the script instead? I have seen a few opinions from long time developers state to keep GUI doing only GUI and all scripting take place elsewhere and pass in vars if they need displaying by the GUI.
Runnin it on Mac Snowleopard, Ill try to seperate the GUI from the object when I get home, but Ive scripted inside OnGUI before never had this happen, but hey heres hoping :D