mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 20:52:10 +01:00
29 lines
551 B
C#
29 lines
551 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Mirror;
|
|
|
|
public class PlayerColor : NetworkBehaviour
|
|
{
|
|
[SyncVar(hook = "SetColor")]
|
|
public Color color;
|
|
public Renderer renderer;
|
|
|
|
void SetColor(Color oldColor, Color newColor)
|
|
{
|
|
if (color == null)
|
|
{
|
|
color = renderer.material.color;
|
|
}
|
|
|
|
renderer.material.color = newColor;
|
|
color = newColor;
|
|
|
|
}
|
|
|
|
public override void OnStartClient()
|
|
{
|
|
renderer.material.color = color;
|
|
}
|
|
}
|