Beispiel #1
0
    public void OnPhotonInstantiate(Photon.Pun.PhotonMessageInfo info)
    {
        // Hide everyone beside me
        if (!info.Sender.IsLocal)
        {
            Renderer[] allRenderers = gameObject.GetComponentsInChildren <Renderer>();
            foreach (Renderer renderer in allRenderers)
            {
                renderer.enabled = false;
            }

            Light[] allPlayerLights = gameObject.GetComponentsInChildren <Light>();
            foreach (Light light in allPlayerLights)
            {
                light.enabled = false;
            }

            Canvas[] allPlayerUI = gameObject.GetComponentsInChildren <Canvas>();
            foreach (Canvas ui in allPlayerUI)
            {
                ui.enabled = false;
            }
        }
    }
Beispiel #2
0
        protected internal void SerializeComponent(Component component, PhotonStream stream, PhotonMessageInfo info)
        {
            IPunObservable observable = component as IPunObservable;

            if (observable != null)
            {
                observable.OnPhotonSerializeView(stream, info);
            }
            else
            {
                Debug.LogError("Observed scripts have to implement IPunObservable. " + component + " does not. It is Type: " + component.GetType(), component.gameObject);
            }
        }