[Bug?] Projectile lifespan

The lifespan variable on the projectile component isnt´t doing what i expect it should do.
Right now it only disables the collider.
What i expect it should do is disable the gameobject and put the gameobject back into the pool.

Reproducible with Arrows:
Set Lifespan on arrow to 2 sec > shoot arrow
After 2 sec without collision the collider gets disabled and the arrow flies endlessly.
 

Justin

Administrator
Staff member
Do you have Destroy On Collision enabled? I wasn't able to reproduce this within the demo scene. When the lifespan elapses it calls OnCollision which eventually calls Destruct if Destroy On Collision is enabled.
 
Sorry for the late reply.

If I enable Destroy On Collision the arrow gets put back into the pool. BUT this introduces another bug.
The Projectile component doesn't get disabled. So if I reuse the arrow from the pool the component is already enabled and collides with the character or the ground.

To reproduce this bug on arrow:
Enable Destroy On Collision
Set Destruction Delay to 5 sec
Set Lifespan to 2 sec
Shoot arrow in the sky so it doesn't collide for 2 sec
 

Justin

Administrator
Staff member
Thanks for the report. I was able to reproduce it and will have it fixed in the next update.
 
Top