- Home /
Unity Object suddenly "freezes"
Hey there,
so I made a Unity2D game for Android and everything works fine - except for one major "problem".
In the game, the protagonist is a circle in the center that is being attacked. It gets damage if an enemy collides with it.
When I play it in the editor or on my smartphone, after a while, it does not respond to collision anymore - even if I do nothing - resulting in it being invincible, and hey, that's fun for the player, but not fun for me :P Aside of the one object "freezing", everything else is working fine...
So, my question is, do you know why this could be? Is there a common problem with Unity2D for Unity3D v4.5.5?
Both, enemy and protagonist have 2D trigger circle colliders, function for collision is OnTriggerEnter2D.
Code: http://pastebin.com/c9hvdg4i NOTE: If I change stuff like "if(damage != -10)" to "if(damage != 10)" it works - and then, when I change something else like "damage += 1" to "damage -= 1" it breaks again, even though nothing of either changes any logic of the game - aside from preventing it to die xD I added Debug.log() Statements to get called even if it just gets any collision - nothing appears!
This bug is annoying, I tried re-installing Unity. I recently upgraded to the BETA 4.6 of Unity, and then "downgraded" again to continue development, before everything worked fine, that's why I tried the re-install. Pointless.
This is really annoying because I was just about to put it on the PlayStore :(
Sincerely, aleichert
Additional information: | OS Windows 7 | Unity3D v4.5 | Target platform Android |
Couple of clarifications
Does your Debug.Log("impact") still turn up on collisions? What about I$$anonymous$$PACT or YEP?
Is it just collisions that are not responding, or does input freeze up as well?
This does not sound like a Unity bug. Its probably something in your code.
Just reread your question again, you already said none of the debugs show up. That means its probably a collider problem. Play the game in the editor until the problem occurs, and check that the various colliders and ridigbodies are all still in place. Nothing has been disabled or deleted.
Hello Bored$$anonymous$$ormon.
Thank you for replying. I did check, both enabled, both triggers.
The enemies are colliding with the circle, though the circle is not responding at all. As if the code wasn't there, it is though, as I can see it in the editor.
I swapped all the visual- and logic changing code to other objects for now. This means that the circle merely is there for visuals. This is a performance hungry option though and not ideal for the future- it can serve as a "temporary replacement" in the meanwhile though so that I can continue development.
Sincerely, aleichert
Your answer