Barrel Config

A BarrelConfig is a ScriptableObject that holds a set of barrel stats. Apply it to any barrel at runtime to swap its stats, for example when the player picks up a power-up or a weapon levels up.

Note

A barrel doesn’t need a config to work. Its own inline Config stats are used until a config is applied.

📦 Creating a Config

Right click in the Project window and choose Create > Glowing Rifts > Modular Weapon System > Barrel Config.

FieldDescription
Bullets FiredBullets fired per shot. Also the ammo one shot uses.
Fire RateShots per second.
DamageDamage per bullet, as a constant or a random range.

⚙️ Applying a Config

barrel.ApplyConfig(config);

ApplyConfig copies the config’s stats onto the barrel. The asset itself is never modified, so several barrels can share one config.

Note

A config holds stats only. To change the muzzles too, call barrel.SetSpawnPoints(points) alongside it. The firing mode stays on the barrel’s Firing Mode.

Tip

Make one config per level and list them on an Upgradable Weapon to get level-ups with no code.