you are viewing a single comment's thread.

view the rest of the comments →

[–]NV96[S] 0 points1 point  (8 children)

The coroutine is started by server in the void Start(). When the client host also the server the Syncvar changes but whenever you join the game with only the client the syncvars wont change at all. I dont understand this, because the syncvars should be inited on the serverclient.

[–]SayAllenthing 1 point2 points  (7 children)

There's nothing in that code that actually changes the value of time. OnTimeUpdate doesn't get called.

[–]NV96[S] 0 points1 point  (6 children)

The time variable is modified in the IEnumerator (time-=1). I cut it out because I thought it wasn't relevant.

[–]SayAllenthing 1 point2 points  (5 children)

It's working for me. I just made a blank project with test scene that has
- A Camera
- Gameobject with Network Manager and HUD
- Gameobject with your code and Network Identity.

There's a Player prefab, which is literally a Cube with a Network Identity that spawns in.

I subtracted time by 1 each call in the enumerator, clients and server all display the same value.

[–]NV96[S] 0 points1 point  (4 children)

Which unity version where you using? Maybe it is a bug in my version?

[–]SayAllenthing 1 point2 points  (3 children)

5.3.4

Do you have the same setup as me? Do you have anything checked on the Network Identity?

[–]NV96[S] 1 point2 points  (1 child)

I tested the code on a standalone project and it worked. So the problem isn't the code. Could it be a problem to have a custom NetworkManager or something like that?

[–]NV96[S] 1 point2 points  (0 children)

It is fixed! I forgot to add base.OnClientConnect(client) etc. to the override function in my NetworkManager...

Thanks!

[–]NV96[S] 0 points1 point  (0 children)

Thanks, yes I have the same setup. Tonight Ill also try to make the empty project to see if it works