И наоборот, цвет другого куба игрока не вижу чтоб менялся у меня на экране.
Создал движение, чтоб определить что работает всё нормально, и работает, если я кручу свой куб, я вижу что у клиента тоже он крутится, но цвет не меняет всё равно!
Как это можно реализовать??
Синтаксис:
Используется csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class PlayQwerty : NetworkBehaviour
{
public float move;
public Color altColor = Color.black;
public Color redColor = Color.red;
public Color greenColor = Color.green;
public Color blueColor = Color.blue;
public Renderer rend;
void Start ()
{
rend = GetComponent<Renderer>();
}
void Update()
{
if (!isLocalPlayer)
return;
move = Input.GetAxis ("Vertical") * Time.deltaTime * 105.0f;
transform.Rotate (0, move, 0);
if (Input.GetKeyDown (KeyCode.G)){
rend.material.color = greenColor;
}
if (Input.GetKeyDown (KeyCode.R)){
rend.material.color = redColor;
}
if (Input.GetKeyDown (KeyCode.B)){
rend.material.color = blueColor;
}
if (Input.GetKeyDown (KeyCode.A)) {
rend.material.color = altColor;
}
}
public override void OnStartLocalPlayer()
{
rend.material.color = altColor;
}
}
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class PlayQwerty : NetworkBehaviour
{
public float move;
public Color altColor = Color.black;
public Color redColor = Color.red;
public Color greenColor = Color.green;
public Color blueColor = Color.blue;
public Renderer rend;
void Start ()
{
rend = GetComponent<Renderer>();
}
void Update()
{
if (!isLocalPlayer)
return;
move = Input.GetAxis ("Vertical") * Time.deltaTime * 105.0f;
transform.Rotate (0, move, 0);
if (Input.GetKeyDown (KeyCode.G)){
rend.material.color = greenColor;
}
if (Input.GetKeyDown (KeyCode.R)){
rend.material.color = redColor;
}
if (Input.GetKeyDown (KeyCode.B)){
rend.material.color = blueColor;
}
if (Input.GetKeyDown (KeyCode.A)) {
rend.material.color = altColor;
}
}
public override void OnStartLocalPlayer()
{
rend.material.color = altColor;
}
}