- Home /
How to affect non-player object in UNET (Multiplayer).
Hi
I am new at unity networking. I just want to affect one server object and it will be synchronised to all other players. For example, I have one sphere and if the any player press "K" key its color change blue, if the player press "L" its color change black and all player will see changes. When I try that, it is not synchronised. How can I fix that?
Answer by draxex · Nov 13, 2018 at 08:19 PM
Yes, but the material not player object. It's common object for clients. I just want to change its color like this:
if (Input.GetKeyDown(KeyCode.K)) { GetComponent().material.color = Color.blue; } if (Input.GetKeyDown(KeyCode.L)) { GetComponent().material.color = Color.black; }
The problem is when I do that client or host side, other player can't see changes. I need some networking code but I don't know :(
And how do you access the Object from the player side to change it's color?
Yes and other player need to see that changes.
No, I mean how do you access the Object script from the Player?
Your answer
Follow this Question
Related Questions
Unity NetworkTransformChild - Syncing the Child of a Child 0 Answers
Master/Slave synchronous data transfer in Unity 0 Answers
Best way to choose Google Play Realtime Multiplayer Host? 0 Answers
Photon Unity Networking (Viking Demo) Error: Argument is out of range. 1 Answer
Setting rotation of another player 0 Answers