Search Unity

Third Party Can't get View ID of GameObject PUN

Discussion in 'Multiplayer' started by SamohtVII, May 31, 2020.

  1. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    370
    So I have a player prefab with a PhotonView on it. I also have this code on a collider...

    Code (CSharp):
    1. if(other.gameObject.GetComponent<PhotonView>().IsMine) {
    2.            GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
    3.  
    4.            Debug.Log(players[1].GetComponent<PhotonView>().viewID); //BROKEN HERE
    5. }

    Can anyone see why this would not work. I have using Photon.Pun; and MonoBehaviourPun but I get the error....

    error CS1061: 'PhotonView' does not contain a definition for 'viewID' and no accessible extension method 'viewID' accepting a first argument of type 'PhotonView' could be found (are you missing a using directive or an assembly reference?)

    Thanks
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    The field is named ViewID in PUN 2.
     
  3. SamohtVII

    SamohtVII

    Joined:
    Jun 30, 2014
    Posts:
    370
    Yep I am dumb. I feel I tried every other combo of uppercase and lowercase. thanks