Forum begins after the advertisement:


Part 18 – Errors when removing the data from the Weapon

Home Forums Bug Reports Part 18 – Errors when removing the data from the Weapon

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #15813
    Boby
    Participant
    Helpful?
    Up
    0
    ::

    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

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: