Upgrading From Older Versions

Upgrading From Older Versions

This version reorganizes how weapons are wired. Older versions migrated old prefabs automatically; that migration has been removed, so prefabs saved with a version before the weapon refactor need to be set up again.

Warning

Back up your project before upgrading. Old prefabs lose their barrel stats, their UnityEvent hooks and their barrel-to-magazine links.

📁 New Folders And Namespace

The package now uses the same layout as the Modular Health System:

BeforeNow
Core (models, materials, sounds, prefabs)Weapons: the ready-made weapons, with their models, materials, sounds and prefabs
Core/InputsRuntime/Input
Runtime/WeaponRuntime/Weapons
Health, Hitbox, DamageDataThe Modular Health System, now required (same GUIDs)
ExampleExamples, opened from the ModularWeaponSystem_Examples hub scene
Example/BlueprintExample/Blueprint Example.unityExamples/BlueprintExample/BlueprintDemo.unity
Example/DuckShooter/Scenes/DuckShooter.unityExamples/DuckShooter/DuckShooter.unity
RocketLancher prefabRocketLauncher

Note

Asset GUIDs are unchanged, so your scenes keep their references. Delete the old package folder before importing so no stale copies are left behind.

✅ What To Redo On Each Weapon Prefab

Assign the magazine on the Weapon

The magazine moved from the barrel to the Weapon (and to Secondary Magazine on a DualWeapon). Leave it empty for infinite ammo.

Re-enter the barrel stats

Bullets Fired, Fire Rate and Damage now live under the barrel’s Config. Damage per bullet replaces the old per-barrel Damage Points.

Add a Firing Mode

The Shooting Mode moved off the barrel’s stats to a Firing Mode component. Add one to every semi automatic or burst barrel. A barrel without one fires full automatic. The burst size is now its Burst Count (3 before).

Rewire the events

Events are now grouped. Re-add your listeners under:

  • events on every barrel (On Start Shooting, On Shot, On End Shooting)
  • hitEvents on raycast and shotgun barrels (On Hit)
  • projectileEvents on projectile barrels (On Projectile Spawned)
  • laserEvents on laser barrels (On Impact)
  • events on magazines (On Depleted, On Start Reload, On Reload Complete)

Check the recoil

The Weapon no longer references the recoil. The Recoil listens to the barrels under it by itself, or to the one in its Barrel field.

Set Pellets Per Bullet on shotguns

The shotgun’s list of pellet particle systems is replaced by Pellets Per Bullet and a single Pellet Trace particle system.

Move laser wind-ups to a Spool

The laser barrel’s Wind Up Time and On Wind Up are gone. Add a Spool to the barrel’s GameObject and set its Wind Up Time instead. Hook your old wind-up listeners to the spool’s On Wind Up Start.

🧑‍💻 Code Changes

BeforeNow
barrel.magazineweapon.magazine
barrel._OnShot and other barrel eventsbarrel.events.OnShot
_OnHithitEvents.OnHit
OnProjectileSpawnedprojectileEvents.OnProjectileSpawned
OnImpact on laserslaserEvents.OnImpact
OnWindUp, windUpTime on lasersA Spool on the barrel: events.OnWindUpStart, Wind Up Time
Overriding Barrel.Prepare(Action)A BarrelModifier implementing BeforeShooting(proceed, cancel)
magazine.OnDepleted and other magazine eventsmagazine.events.OnDepleted
Recoil.FollowRemoved: assign the recoil’s Barrel field, or leave it empty
Get* barrel gettersFireRate, BulletsFired and config
shootingMode in BarrelStats and BarrelConfigFiringMode.mode on the barrel
Changing barrel stats directlybarrel.ApplyConfig(barrelConfig)
using GlowingRifts.ModularWeapons;using GlowingRifts.ModularWeaponSystem; (.Example for the example scripts)
WeaponEvents.OnEquipedWeaponEvents.OnEquipped
CubicSpline.GetGradientSamples, GradientSample and LengthRemoved (unused)
Create > Glowing Rifts > Modular Weapons > Barrel ConfigCreate > Glowing Rifts > Modular Weapon System > Barrel Config
Health, Hitbox, DamageData, Hitpoint in GlowingRifts.ModularWeaponsNow in the Modular Health System, namespace GlowingRifts.ModularHealthSystem
Hitpoint hooked to a hitbox’s On HitHook On Hit to Hitpoint.ShowDamage; ShowText shows any text
Health.Kill() always destroying the objectDestroy On Death toggle, plus OnDeath, Heal(DamageData), AffectHealth, ResetHealth

✨ New In This Version

  • Barrel Config assets and barrel.ApplyConfig
  • Upgradable Weapon with a list of level configs
  • barrel.SetSpawnPoints to change muzzles at runtime
  • Firing Mode for semi automatic, burst and full automatic
  • Spool wind-up and wind-down, and custom barrel modifiers
  • Health modifiers, including Invincibility
  • Infinite ammo when a weapon has no magazine
  • The Duck Shooter example