Weapon reference

Isnt it just simpler to get the current weapon reference form the current weaponSO and let the current WeapomSO lazy value as its ?



Not really, because what you are getting is the prefab in the assets folder, that does not actually exist within the scene until it is spawned.
In fact, I would be very surprised if that OnHit did anything at all.

The idea is that by having the weapon spawned in the location that it actually makes the hit, then any sound effects or special effects (blood splatter, perhaps) can be instantiated at the point of the weapon in the game. This means that the hit sound will sound like it’s coming from where the weapon hit the enemy, etc. Referencing the prefab on the disk won’t accomplish this.

its true but an easy way around it is to ref the last instantiated Weapon and return it.

And if seven enemies are using the same weapon?

Privacy & Terms