16 lines
376 B
C#
16 lines
376 B
C#
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace Mirror.Examples.AssignAuthority
|
||
|
|
{
|
||
|
|
[AddComponentMenu("")]
|
||
|
|
public class ObserverBehaviour : NetworkBehaviour
|
||
|
|
{
|
||
|
|
[SyncVar(hook = nameof(OnColorChanged))]
|
||
|
|
public Color Color;
|
||
|
|
|
||
|
|
public MeshRenderer MeshRenderer;
|
||
|
|
|
||
|
|
void OnColorChanged(Color _, Color newColor) => MeshRenderer.material.color = newColor;
|
||
|
|
}
|
||
|
|
}
|