Cant disable bool
Hey, so I'm setting a bool to true while its in a trigger it wont go back to false, please help
Answer by AlienNova · May 05, 2016 at 05:05 AM
Try adding an OnTriggerExit method and using that to disable canBuy.
Be sure to remove OnTriggerStay and also add OnTriggerEnter
Thanks! I apllied it to a different script that didnt have OnTriggerStay and it worked thank you!
Answer by Piflik · May 03, 2016 at 01:42 PM
OnTriggerStay is only called while the Object is inside the collider. If you want to set canBuy to false, when the object leaves the collider, use OnTriggerExit. Also I would use OnTriggerEnter to set it to true.
Answer by tanoshimi · May 03, 2016 at 05:58 AM
Check your brackets - your else corresponds to the if 5 lines above it, not 3 lines above it. (And please paste actual code, not pictures of code - it makes it hard to help you)
postinf the whole code wont help anymore actually, i usually post it all, but in this case it doesnt matter