NEWB: Marco Polo Monster

Im running thru the Marco Polo Doc, and making the monster game:

Im down to Page8, and get 2 spawned monsters, from 2 running clients; both walk when one moves however..
So I continue.. to...
void OnJoinedRoom()
{
GameObject monster = PhotonNetwork.Instantiate("monsterprefab", Vector3.zero, Quaternion.identity, 0);
myThirdPersonController controller = monster.GetComponent<myThirdPersonController>();
controller.enabled = true;
myMonsterPv = monster.GetComponent<PhotonView>();
}

Im getting
Assets/MarkoPolo/RandomMatchMaker.cs(41,9): error CS0103: The name `myMonsterPv' does not exist in the current context

And that all compiler errors have to be fixed etc etc...

Can someone tell me what I have done?

Mark

Comments

  • Hi markfrancombe,

    it looks like your variable 'myMonsterPv' has never been declared. You should declare it with the 'var' keyword:
    void OnJoinedRoom()
    {
       GameObject monster = PhotonNetwork.Instantiate("monsterprefab", Vector3.zero, Quaternion.identity, 0);
       myThirdPersonController controller = monster.GetComponent<myThirdPersonController>();
       controller.enabled = true;
       var myMonsterPv = monster.GetComponent<PhotonView>();  // <- inserted 'var' here
    }
    


    solved it?




    Tim
Sign In or Register to comment.