🚀Projectile

v1.0

A Projectile is the GameObject that gets spawned and (probably) moves around the world looking for a target to smash into.

The Projectile component has a number of Scriptable Objects which determine how the projectile behaves in the world, from spawning, to motion, destruction, speed, and more.

The "Bullet Blue" projectile from the Sci-Fi Arsenal integration.

The custom Inspector is where you add all the details required to make an awesome projectile! The overviews below will introduce you to each section. Check the detailed pages for complete information.

Projectile Data

Each Projectile needs a Projectile Data object attached to it. This will hold specific data like speed or other things, which the Behaviors will make use of.

You may want to create a class which inherits from ProjectileData, to include custom information and logic for your project.

Projectile Data

Spawn Behavior & Spawn Behavior Modification

The Spawn Behavior for the Projectile, along with any Spawn Behavior Modifications determine how the projectiles are spawned. This includes the speed at which they are spawned, and even how many -- from a single projectile to a machine gun, and more.

The Spawn Behavior Modifications are optional behavior scripts that fire once, right after the Projectile is spawned, and before any Behaviors activate. You can have as many Spawn Behavior Modifications as you'd like.

In the demo scenes, any "Laser" Projectile will have a "Parent to Spawn Point" modification, which ensures the Projectile is parented properly to the spawn point, so it can rotate as expected.

Many Projectiles also use a Spawn Behavior Modification to create a "Muzzle" particle, as shown above.

Spawn BehaviorSpawn Behavior Modification

Behaviors

Behaviors determine how the Projectile behaves (get it?). From movement through collision and destructions, each Behavior will typically do a single thing. This allows you to quickly build up the behavior of any particular Projectile, and easily modify behaviors to create the perfect Projectile for your project.

You can also create your own Behaviors! If you want something that doesn't exist already, it's easy to create a new behavior, or override an existing one to customize things exactly as you'd like for your project.

🕊️Behaviors🤩Create Custom Behaviors

Events

Each Projectile has UnityEvents exposed, allowing you to hook into the Projectile lifecycle.

Options

Register with Factory Manager

The Factory Manager allows for Global Observers to react based on all projectile lifecycle events. Toggle this off if you do not want this projectile to register itself with the Factory Manager.

Object Pooling

Keep this toggle on to use the built in Object Pooling system. When false, this projectile will instantiate and destroy during runtime.

Trajectory

Each projectile can have an optional pre-launch Trajectory, intended to provide some sort of indication to the player about where the projectile may go. Projectile Factory ships with a few trajectories, and you can create your own as well.

Last updated

Was this helpful?