Join the Discord

Unity tools by Magic Pig Games

Projectile Factory

Build bullets, missiles, spells and beams from swappable behaviors

Projectile Factory is a Unity asset by Magic Pig Games that turns any particle effect or prefab into a projectile built from swappable behaviors for movement, collision and destruction. Use this behavior-based projectile system for bullets, homing missiles, magic spells, lasers and shotgun spreads.

Version 1.2.5 · updated September 19, 2026 · Unity 6.0 or newer

What Projectile Factory does

  • Swappable behaviors, about 50 included

    Each projectile is assembled from behavior assets for movement, collision, destruction, audio and aim preview. About 50 ship with Projectile Factory, including homing, wave motion, ricochets, arrows that stick, knockback, beams, hitscan and area hits.

  • Any particle effect becomes a projectile

    Add a Projectile component, a Rigidbody and a collider to any particle effect, prefab or model, and it works like every other projectile in your game, whichever Asset Store pack it came from.

  • Shotgun, burst and full-auto patterns

    A Spawn Behavior asset sets how each shot fires: how many projectiles, horizontal and vertical spread, spread pattern, delays and repeats. Swap it to turn a single shot into a shotgun blast, a burst or a continuous stream.

  • One spawner for every weapon

    Put a Projectile Spawner on a gun, wand, ship or turret. It holds your projectiles, target, spawn points and collision mask, and your code fires with SpawnProjectile(), switches with NextProjectile() and stops with StopProjectile().

  • Observers and global events

    React to launches, hits and destroys without changing flight logic, using observers on a spawner, observer components in the scene, UnityEvents, or FactoryManager global events for game-wide systems like damage, score and camera shake.

  • Object pooling built in

    Projectiles are pooled by default. With a Projectile Pool Manager in the scene, destroy behaviors return projectiles to the pool instead of destroying them, and impact effects can be pooled too.

  • Free particle pack integrations

    Free integrations turn popular Asset Store particle packs from Synty Studios, Archanor VFX, Hovl Studio, Jean Moreno, Gabriel Aguiar Prod and others into ready-to-use projectiles. The particle packs are sold separately.

  • AI skills for coding assistants

    Bundled skills let Claude Code, Codex and other AI assistants set up spawners, turn particle effects into projectiles and write new behaviors for you, with or without Unity's MCP bridge.

Works with AI coding assistants

Projectile Factory comes with skills for AI coding assistants such as Claude Code and Codex. Once they're installed, your assistant knows how Projectile Factoryworks, so you can ask for what you want in plain English:

  • “What can you do with Projectile Factory?”
  • “Turn this fireball particle effect into a projectile that homes in on the enemy and explodes on impact.”
  • “Add a Projectile Spawner to my turret that fires a 5-shot shotgun spread.”
  • “Spawn an explosion when the rocket hits something.”
  • “Write a behavior that splits the projectile into three on impact.”

How it works

A projectile is a prefab with a Projectile component on its root, a Rigidbody and usually a trigger collider, with your particle systems or meshes as children. The Projectile holds a ProjectileData asset (speed and damage), a Spawn Behavior and a list of behaviors. It raises lifecycle events for launch, collisions, triggers, destroy and pooling, and every behavior listens to them.

Behaviors are ScriptableObject assets, grouped as movement, collision, destroy, audio and trajectory (aim preview). At launch, each behavior asset is cloned for that projectile, so many projectiles can share one asset without sharing state. For example, a homing missile that explodes on impact takes three behaviors: HomingMovementBehavior, DestroyOnTriggerOrCollision and SpawnObjectOnDestroy set to your explosion prefab.

A ProjectileSpawner goes on whatever fires: a gun, wand, ship or turret. It keeps a list of projectile prefabs, a target, spawn points for multiple barrels, and a collision mask. From your player or NPC code:

  • SpawnProjectile() fires the active projectile
  • StopProjectile() stops a repeating or continuous shot
  • NextProjectile() and SetProjectile() switch projectiles
  • SetTarget() sets what homing and look-at behaviors aim at

The Spawn Behavior decides how a shot comes out (count, spread, pattern, delays and repeats). Spawn Behavior Modifications adjust each projectile before launch, such as giving a grenade physics velocity or spawning the shot on the target. For instant hits, RaycastShooter and its handlers drive hitscan guns and beams with line renderer visuals, and they raise the same collision events.

The spawner’s inspector has Runtime Test buttons to start and stop spawning and step through projectiles, and the Projectiles Quick Editor adds, removes or replaces behaviors on many projectiles at once.

Events, observers and pooling

To react to projectiles without changing their flight (for damage, score or camera shake), use:

  • Observers on a spawner, copied to every projectile it fires
  • ObserverObject and SpawnerObserverObject components that watch one projectile or spawner
  • UnityEvents in the inspector
  • FactoryManager global events such as OnLaunchGlobal and CollisionEnterGlobal, for game-wide systems

Projectiles are pooled by default. With a Projectile Pool Manager in the scene, destroy behaviors return projectiles to the pool instead of destroying them.

Writing your own behaviors

When none of the behaviors we ship fits, subclass MovementBehavior, CollisionBehavior, DestroyBehavior, ProjectileObserver or another base class, and override only the events you need, such as LaunchProjectile, TriggerEnter or Tick (the projectile calls it every frame). Add [ShowInProjectileEditor] to a field to show it in the Projectile inspector. Subclass ProjectileData to calculate speed or damage from your own stats, or SpawnBehavior for custom fire patterns.

Pooled projectiles are reused, so reset per-shot values on launch and release anything you started when the projectile returns to the pool. The bundled AI skill follows these rules when it writes behaviors for you, and the scripting documentation has a page for each of these systems.

More videos

Questions about Projectile Factory

Can I use particle effects from other Asset Store packs?

Yes. Any particle effect, prefab or model can become a projectile once it has a Projectile component, a Rigidbody and a collider. Free integrations for popular packs, such as POLYGON Particle FX, Cartoon FX Remaster and Hovl Studio's projectile packs, include ready-made projectiles, but the particle packs themselves are not included.

Can Projectile Factory make homing missiles, shotguns and lasers?

Yes. HomingMovementBehavior steers a projectile toward the spawner's target, a Spawn Behavior with several projectiles and a spread angle makes a shotgun blast, and the Beam behavior and raycast tools handle lasers and instant-hit weapons.

How do I apply damage when a projectile hits something?

Call your own damage code from an observer on the spawner, a UnityEvent, or a FactoryManager global event such as CollisionEnterGlobal. The demo scene uses an observer to damage the target, and ProjectileData carries a damage value that you can subclass to calculate from your own stats.

Does Projectile Factory use object pooling?

Yes, projectiles are pooled by default. Add a Projectile Pool Manager to the scene; without one, Projectile Factory logs a warning and instantiates each shot instead.

Does it work with Game Modules 4, Magic Time and Juicy Actions?

Yes. Included integration packages let Game Modules 4 characters fire projectiles that damage other Game Modules 4 actors, and make projectiles follow Magic Time's per-object time scales for slow motion. Juicy Actions for Projectile Factory adds actions that run on projectile and spawner events.

Which Unity versions and render pipelines does it support?

Unity 6.0 or newer; the Asset Store lists Unity 6000.0 and 6000.3. The tool works the same in any render pipeline, and the demo scene uses the Built-in Render Pipeline in the Unity 6.0 version and URP in the Unity 6.3 version.

Can an AI coding assistant set up Projectile Factory for me?

Yes. For Claude Code or Cowork, run the bundled install.sh in your project; for Codex, copy the projectile-factory skill folder into .agents/skills. Then ask your agent to build projectiles in plain English, and ask "What can you do with Projectile Factory?" to confirm the skills are active. With Unity's MCP bridge running, the agent builds the assets in the Editor; without it, it writes an editor script that you run from a menu item.