photonView.IsMine - Why doesn't it update for only me?

I had a friend help me with a shield script which works wonderfully...but the main problem is that when I try to use it...it still shows up on ALL the other players as well at the same time even though I'm trying to use the photonView.IsMine function. Can anyone help me with this?

unknown.png

unknown.png

Answers

  • You re-defined photonView and probably set it to one PhotonView for all the characters.
  • Tobias wrote: »
    You re-defined photonView and probably set it to one PhotonView for all the characters.

    I'm still fairly new to this, so I'm not sure what you mean by re-defined photonView?

    I was trying to add in the Photon View component to distinguish from the others. So even if I removed these:
    private PhotonView photonView;
    
    photonView = GetComponent<PhotonView>();
    
    if (photonView.IsMine) {}
    

    Then it still does the exact same thing.

    I'm just not sure as to how to use the PhotonView.IsMine function that would allow it to go for just a single character.
  • Tobias
    Tobias admin
    edited September 14
    Only remove the photonView definition and assignment.

    If one client instantiated each of the characters, then IsMine will be true on each. If you started multiple clients and each created one character, then IsMine will only be true on one character...

    I would recommend to read and code-along the PUN Basics Tutorial. This should help you get the theory.