Question by
$$anonymous$$ · Feb 02, 2017 at 11:41 PM ·
networkingmultiplayerlightclient
How To Sync Lights So The Other Client Can See The Current State Of the light
Please Help when I press the button to turn off the light the other player still sees it as on
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class OnOff : NetworkBehaviour {
public GameObject other;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (isLocalPlayer ) {
if (Input.GetButton("Fire1")) {
GetComponentInChildren<Light>().range = 0;
}
if (Input.GetButton("Fire2")) {
GetComponentInChildren<Light>().range = 30;
}
}
}
}
Comment
I can't see where you send a command over to the other player to switch it off.
Your answer
Follow this Question
Related Questions
API for multiplayer game with authoritative server? 1 Answer
Destroy only player after disconnecting from server 0 Answers
How to allow All clients to move blocks? 0 Answers
Spawning GameObject on network, locally change it only on the client that spawned it. 0 Answers
Remote clients can no longer connect with new modem / router 0 Answers