-1

I am trying to call some code from my PlayerManager script into my PlayerController script. This is the code in the PlayerManger script:

public void Died()
    {
        PhotonNetwork.Destroy(controller);
        CreateController();
    }

And this is the code in my Playercontroller script:

void Die()
    {
        PlayerManager.Died();
    }

When I try to run my code, I get the error: "An object reference is required for the non-static field, method, or property 'PlayerManager.Died()'" Can someone tell me what is wrong with my code, or what I have to do to fix it.

derHugo
  • 83,094
  • 9
  • 75
  • 115

1 Answers1

1

I think you should change code like this

You cannot execute non-static method

public static void Died()
    {
        PhotonNetwork.Destroy(controller);
        CreateController();
    }
soon
  • 33
  • 3