Totally SOLVED how to get photon view or game object of owner

Options
Hi
i have an scene object and i want to be able to get the game object of the current owner - is this possible? i ve searched for hours with no success.
thanks in advance for the help

Comments

  • cherrybombe
    edited September 2017
    Options
    partially solved

    if anybody else needs this - only seems to work with

    PhotonNetwork.player.TagObject



    Instantiate
    GameObject pl = PhotonNetwork.Instantiate (playerprefab.name, spawnPt.position,spawnPt.rotation, 0) as GameObject;
    		pl.GetComponent<PhotonView>().owner.TagObject = pl;
    to get the game object of the owner
    PhotonPlayer p = photonView.owner;
    GameObject pp = p.TagObject as GameObject;

    even when p does not return null, owner.tagObject returns null every time

    Any ideas why tagObject doesn't work like this?
  • i misunderstood how tag object works,
    make sure you set owner.tagobject from void Start() on a script on the photon view and not during PhotonNetwork.Instantiate

    this works:)