::Hello,
On the Part 18 around 51:40, when I put the spawnedWeapon.Initialise(data) before the spawnedWeapon.OnEquip() and delete the Start and Awake in the Weapon, I’ve got two errors, running in a loop when I start the game :
NullReferenceException: Object reference not set to an instance of an object
Weapon.Update () (at Assets/Scripts/Weapons/Weapons Sysetm/Weapon.cs:71)
ProjectileWeapon.Update () (at Assets/Scripts/Weapons/Weapons Sysetm/ProjectileWeapon.cs:9)
Pointing on thoses code :
Weapon.cs 71
protected virtual void Update(){
currentCooldown -= Time.deltaTime;
if(currentCooldown <= 0)
//Define the number of projectile to instantiate
Shoot(currentStats.number + owner.Stats.amount); here
}
ProjectileWeapon.cs 9
protected override void Update(){
base.Update(); here
if(currentShootInterval > 0){
currentShootInterval -= Time.deltaTime;
if(currentShootInterval <= 0) Shoot(currentShootCount);
}
}
Thank you