Tag Archives: collider

The Case of the Lingering Collider

Unity 3 for iPhone has some new behavior that I just ran into. When switching from one Pawns puzzle to the next, my code destroys one set of objects then creates others. This has worked for years, but in Unity 3 builds running on an iPhone, I noticed that the colliders of just-destroyed objects are now sometimes hitting objects being created afterwards.

This only happened when running on the actual device, not in the editor. Weirdly, I only see it happening for colliders on a particular type of object (the red checkers.)

My workaround was to deactivate each object just before destroying it:

	foreach (GameObject gameobj in transients)
	{
            gameobj.active = false;  // <-- NEW
	    Destroy(gameobj);
	}
        // .. create new objects, etc..

I should probably file a bug on this, but since it doesn't happen for all my objects I can't say for certain that I have the problem entirely figured out. So I'll need to find time to work up a solid example. What little time I have at the moment is spent on a couple thorny GUI issues (will post about that soon.)

Sorry this is so vague, but I figured that it was worth mentioning on the off-chance that it helps someone. If I learn more I'll post.