Yes, This Uses Mirror/Unet
The Clients TagManager Script does update and the ‘tagged’ bool does get ticked, but the material just doesn’t change for the host or any other client at all
thing is when the host gets tagged though, the material does change and show on all the other clients.
Please Help.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class TagManager : NetworkBehaviour
{
public Material regularMat;
public Material taggedMat;
public CapsuleCollider TagBox;
public bool tagged;
private void Start()
{
if (isLocalPlayer)
{
TagBox.enabled = false;
}
else
{
//gameObject.GetComponent().enabled = false;
}
}
private void Update()
{
if(isServer)
{
RpcUpdateTag();
}
}
private void OnTriggerEnter(Collider other)
{
if(other.tag == “TaggedPlayer” && !tagged)
{
tagged = true;
Debug.Log(“client has been tagged”);
}
else if(other.tag == “Player” && tagged)
{
Debug.Log(other.name + “has been tagged”);
}
}
[ClientRpc]
public void RpcUpdateTag()
{
if (!tagged)
{
Debug.Log(name + “is not tagged”);
}
else
{
Debug.Log(name + “is tagged”);
gameObject.GetComponent().material = taggedMat;
}
}
}