Question regarding OnTriggerEnter and Application.LoadLevel
Greetings!
On a project I'm working on, I'm using a OnTriggerEnter and Exit to interact with my GameObjects. They work great until I restart the level using Application.LoadLevel. Once I do that, none of my game objects are registering with the trigger colliders.
I've tried adding/removing rigidbodies, making them kinematic, and removed all static variables with no luck.
Has anyone encountered a similar issue or have any additional ideas?
Answer by Dibbie · Nov 19, 2015 at 09:29 AM
In the Editor, whenever I do LoadLevel, my lighting always gets turned off and its still there and works fine, it just for some reason, no longer emits inside the editor... But once I export the game, thats not an actual problem, so it could be one of those fun things Unity Editor does. Try exporting your game and see if it still gives you the same error. If not then its one of those Unity things, which you should be able to get around with I think... "Application.isEditor" or something, you could put in an Update function that always runs on a script, something like:
if(Application.isEditor == true){ myGameObject.Getcomponent().enabled = true; }
or something along those lines, to ensure even in the editor, you dont dont run into problems like that.
Your answer
Follow this Question
Related Questions
Trigger enter and directly Exit 0 Answers
Help with Trigger Colliders.. 0 Answers
1 Restart Scene multiple levels. Is this possible? - C# - 1 Answer
Bullet destroy 2 game object intent one Unity 2D 0 Answers
My checker work 2 times 0 Answers