Photon Pun OnTriggerEnter function

Hello, in my script 2 players side by side i have activated a button , button name is raceButton.Function works when the 2 players come side by side, the test button is active,but the raceButton button is active in all players. I just want to be active in side-by-side players.

How can I do that.

This is my code:
  private void OnTriggerEnter(Collider other)
        if (other.gameObject.tag=="Player")
            Debug.Log("Araçlar yanyana");
            target = other.gameObject.transform;
            view.RPC("VeriGonder", PhotonTargets.AllBuffered, sender.gameObject.GetPhotonView().viewID, target.gameObject.GetPhotonView().viewID);

    void VeriGonder(int senderView, int targetView)
        sender = PhotonView.Find(senderView).transform;
        target = PhotonView.Find(targetView).transform;

        ownerId = sender.gameObject.GetPhotonView().viewID;
        playerNameText = target.GetComponent().owner.NickName;



  • Nori_SCNori_SC
    edited August 13
    (I'm not sure if that's what you mean)

    1.if you want two players to activate a given action is first of all trigger trigger suitable for this,but add an object that is entered into the list area otherwise nothing will happen
    2. and when you create, e.g. a door that is owned by another player, you only check if this player is the owner or not, you can display the nickname of the owner, but the text requires synchronization

    use animation to activate objects, it's easier to synchronize
Sign In or Register to comment.