I’m quite new to Unity, but not new to programming. For the demo of the game I’d like to create, I’d want to make 2 different characters, one that deals with raycast/hitscan guns, and the other works with projectile guns (grenades, etc.). The primary mechanic of the demo I plan to build deals a lot with upgrading these default guns until they functionally feel like new weapons. I’ve been doing a ton of reading/listening/watching about this sort of task and it seems like ScriptableObjects seems to be the way to approach this. Because of my newness to Unity, I am very confused on how I’d set such a system up. This is what I had in mind:
-
WeaponData : ScriptableObject → fire rate, damage, etc.
-
RaycastWeaponData : WeaponData
-
ProjectileWeaponData : WeaponData → projectile prefab reference, set projectile speed, etc.
-
WeaponUpgradeData : ScriptableObject
-
FireRateUpgrade : WeaponUpgradeData
-
etc…
And then for the MonoBehaviors:
-
WeaponBase : MonoBehavior → (OnPrimaryFire(), OnAltFire(), Reload(), etc.)
-
WeaponGrenadeLauncher : WeaponBase
-
WeaponRifle
and each MonoBehavior class would grab data from the respective ScriptableObjects to set up the gun. Does this sound like a correct implementation of ScriptableObjects, and are there better ways to build a weapon system like this? I feel like I’m overthinking this, but I’m not entirely sure. If anyone has any suggestions on how to make this more robust or even simplify it a bit more, I would love to know. Sadly, I can’t find really any examples about using this sort of system on a gun system anywhere, and I feel like I’ve looked everywhere!