💡FAQs + Important Reminders
v1.0
My objects disappear right after being spawned
Check to see if there is a Destroy on Collision behavior. Depending on the Projectile, some can be destroyed as soon as they collide, as in situations where they also spawn an "impact" particle that isn't part of the projectile.
In other cases, the Projectile will have particles that need to finish their lifetime. If this isn't happening, check the Destroy behavior, and add time to the destroyDelay
value.
Objects go back to the Object Pool too soon
As soon as the "Destroy" call happens, the object will be sent back to the pool. However, using the destroyDelay
value, you can force the Object Pool to hold the object for some period of time before making it available to be pulled back out.
Similar to the "My objects disappear" question, this often comes into play when the Projectile needs to finish some lifetime effects, like audio or particles, after it has Collided.
My projectiles don't collide; Fly right through objects
Check to make sure the Collision Mask is set up on the Projectile Spawner object. Scripts which have a LayerMask
option will default to inherit this from the Projectile Spawner including Collision Behaviors. Each Projectile can override this value -- make sure that your Projectiles aren't changing this to an undesired setting.
Also make sure you have some mechanism to collect hits -- either a collider
on the object, or a raycast behavior on the Projectile.
And, make sure that you have a behavior that actually does something on collision. Otherwise, nothing will happen beyond any physics interactions like bumps.
Reminder: Set the layer of your projectiles to "Projectile" or something similar
By default, your projecitles may be in the "Default" layer. Often projectiles will also collide with "Default" and other specific layers. Generally you'll want your Projectiles to be in their own layer, and it's easy to forget to do this.
Last updated