2D Toolkit Forum

2D Toolkit => Support => Topic started by: EddyL on June 27, 2012, 05:08:48 am

Title: Destroying object immediately is not permitted during physics trigger
Post by: EddyL on June 27, 2012, 05:08:48 am
I got this message when flipping an animated sprite after a collision with a Box Collider
Quote
Destroying object immediately is not permitted during physics trigger

Quote
   
void OnCollisionEnter (Collision collision)
{
   if(collision.gameObject.tag=="GroundCollider")
   {
      anim.FlipX (); // Seems to be the source of the problem
   }
}

My Animated Sprite uses the "BoxTrimmed" Collider..

Anything I am missing here??
Sorry, and thanks!!
Title: Re: Destroying object immediately is not permitted during physics trigger
Post by: unikronsoftware on June 27, 2012, 01:34:03 pm
Hi,

This should be fixed in 1.75 final. The reason its doing that is in the editor, the collider is recreated every time it is modified to avoid some issues. In game however, the collider will only be resized.

The patch in 1.75 basically makes it run the "game" path when the editor is in Play mode.
Title: Re: Destroying object immediately is not permitted during physics trigger
Post by: EddyL on June 30, 2012, 04:12:12 am
So I should just wait for the update then, thanks!!
Title: Re: Destroying object immediately is not permitted during physics trigger
Post by: unikronsoftware on June 30, 2012, 10:10:10 am
1.75 final is already out - the issue should've been resolved in there.