Skip to content

E.13 (Muzzle Flash) #42

@DoodyDan

Description

@DoodyDan

Hi,

I'm getting an error:

NullReferenceException: Object reference not set to an instance of an object
PlayerShoot.Update () (at Assets/Scripts/PlayerShoot.cs:32)

This happens once a second player enters the network. The line that gives the error is:

    if (currentWeapon.fireRate <= 0f)
    {
        if (Input.GetButtonDown("Fire1"))
        {
            Shoot();
        }

After Debugging - it seems that currenWeapon is assigned when the host is playing in the server - but as soon as a second client joins, this reference gets broken. Any ideas?

Here is my PlayerShoot Script: https://www.codepile.net/pile/BNWvbZRM
Here is my WeaponManager Script: https://www.codepile.net/pile/d3orgj1D
Here is my PlayerWeapon Script: https://www.codepile.net/pile/L8m56W8J

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions