Quantcast
Channel: Questions in topic: "renderer.enabled"
Viewing all articles
Browse latest Browse all 99

Keypress.ismine?

$
0
0
how do I say "if I press the key, ALL clients should see MY player's change?" Photon RPC calls seem to affect my code in ways that appear to be close, but no cigars. using UnityEngine; using System.Collections; public class sheildWeild : MonoBehaviour { private bool weild; private PhotonView myPhotonView; public static string setRenderer = "SetRenderer"; // Use this for initialization void Start () { myPhotonView = this.GetComponent(); weild=true; Debug.Log (weild); } // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.BackQuote)) { if(weild==false) { this.myPhotonView.RPC("SetRenderer", PhotonTargets.AllBuffered, true); weild=true; } else { this.myPhotonView.RPC("SetRenderer", PhotonTargets.AllBuffered, false); weild=false; } } Debug.Log (weild); } [RPC] void SetRenderer(bool weild){ //if ANYONE presses "`" if(myPhotonView.isMine)//affect MY sheild myPhotonView.renderer.enabled = weild; //renderer.enabled=weild; } } ![alt text][1] [1]: /storage/temp/18859-12-3pun.jpg

Viewing all articles
Browse latest Browse all 99

Trending Articles



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