Timeline for Problem using Event Trigger Unity to change bool , but bool keeps setting back to false
Current License: CC BY-SA 3.0
20 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 26, 2017 at 1:26 | vote | accept | Big T Larrity | ||
| Nov 15, 2017 at 4:06 | answer | added | Big T Larrity | timeline score: 0 | |
| Nov 15, 2017 at 3:53 | comment | added | Big T Larrity | I think you hit the nail on the head as usual @JoshPetrie . Basucally the Event trigger was working on a non-instantiated version of my Player script, because I normally instantiate the player in runtime after the new game button is pressed. But if I drag the Player prefab into the game heirarchy, i can then pull that across to the event trigger and hey-presto it works. If only I could figure out how to set the event trigger at runtime then because having to drag the Player into the heirarchy seems odd | |
| Nov 15, 2017 at 3:37 | history | edited | Big T Larrity | CC BY-SA 3.0 | added 59 characters in body |
| Nov 15, 2017 at 3:30 | history | edited | Big T Larrity | CC BY-SA 3.0 | added screenshot |
| Nov 15, 2017 at 3:24 | comment | added | Big T Larrity | I think the screenshot really describes what i am talking about, in conjunction with the class being called by the Event Trigger on the right. I really cant understand why this isnt working. The button definitely works, but the bool goes straight back to being 'false | |
| Nov 15, 2017 at 3:22 | history | edited | Big T Larrity | CC BY-SA 3.0 | added screenshot |
| Nov 15, 2017 at 3:18 | comment | added | Big T Larrity | ah, I removed it coz it cluttered the log, and i wanted to see if the toggle was working. It was just Debug.Log("is left toggled: " + isLeftToggled); (inside the very bottom of the update method i had it) | |
| Nov 15, 2017 at 3:17 | comment | added | user1430 | I don't see the "update method that constantly informs you" of anything about isLeftToggled? I see Update() calling HandleInput() which rotates something if isLeftToggled is true, but that could easily be misread. | |
| Nov 15, 2017 at 3:17 | comment | added | Jay | Only other thing I can think of it ToggleButtonLeft gets called twice as much as you think it does? | |
| Nov 15, 2017 at 3:15 | comment | added | Big T Larrity | @Jay cheers dude, but I have just left the rightToggle. Havent really started doing that yet til the left works lol | |
| Nov 15, 2017 at 3:15 | comment | added | Big T Larrity | I've just opened an old project of mine (Im re-learning after long break unfortunately!), i did it the exact same way last time without a hitch. I remember thinking how lovely the Event Trigger was | |
| Nov 15, 2017 at 3:15 | comment | added | Jay | Your right toggle is checking (!isLeftToggled), maybe another issue is going on | |
| Nov 15, 2017 at 3:12 | comment | added | Big T Larrity | thanks @Jay Ill look through now to be sure there isnt a statement like that anywhere | |
| Nov 15, 2017 at 3:12 | comment | added | Big T Larrity | @JoshPetrie thanks again Josh. ive posted the class now, hope its not too long to see the part you mean | |
| Nov 15, 2017 at 3:11 | comment | added | Jay | Also if it fixes itself when you remove code, be sure you didn't write if (isLeftToggled = false) | |
| Nov 15, 2017 at 3:11 | history | edited | Big T Larrity | CC BY-SA 3.0 | added full class code |
| Nov 15, 2017 at 3:07 | comment | added | Big T Larrity | @JoshPetrie Sure I will grab it now and adjust my question . thanks for looking pal | |
| Nov 15, 2017 at 3:05 | comment | added | user1430 | "isLeftToggled" is likely an instance variable, and you're liking executing ToggleButtonLeft on a different instance than the one you're logging. Post the definition of the class including the declaration of isButtonLeft and the code where you log the value. | |
| Nov 15, 2017 at 2:48 | history | asked | Big T Larrity | CC BY-SA 3.0 |