Update of a material for the players
Options
Hey,
I have a problem with my code, I try to synchronize a changing texture. I have this script at the moment. For now the texture only changes for the masterclient.
using Photon.Pun; using UnityEngine; using static UnityEngine.Random; public class UpdateMaterial : MonoBehaviour { public Material M; PhotonView view; void Update() { M = gameObject.GetComponent<Renderer>().material; view = GetComponent<PhotonView>(); if ((view.IsMine) && (PhotonNetwork.IsMasterClient)) { view.RPC("setTexture", RpcTarget.AllBuffered); } } [PunRPC] public void setTexture() { gameObject.GetComponent<Renderer>().material.mainTexture = M.mainTexture; } }
0
Comments
-
Any errors logged to console?
0