Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Object in the scene with a collider, photonview.ismine only true for the master client

$
0
0
I have a cube within my scene with the below Fire script attached. The object also has a photon view component.

The photonView.isMine is always false, unless you trigger the collider with the master client / the first to connect to the room.

The cube is set as a scene object. Do I need to move that functionality into an RPC call to .All?
    public class Fire : Photon.MonoBehaviour
    {
        private SphereCollider _sphereCollider;
        private float _heatIncrement = 10f;

        void Start()
        {
            _sphereCollider = GetComponent<SphereCollider>();
            if (_sphereCollider == null) throw new MissingComponentException("Sphere collider missing");
        }

        private void OnTriggerStay(Collider other)
        {
            if (other.tag != "Player") return;
            if (!photonView.isMine) return;

            PlayerNetwork player = other.GetComponent<PlayerNetwork>();
            if (player == null) throw new MissingComponentException("Player missing Player script.");
            player.IncreaseTemp(_heatIncrement * Time.deltaTime);
        }
    }

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>