Unit spawning timer not updating on client side - solved

Hi all,

Took me about an hour of poking at this to sort out what I’d done wrong. I thought I’d make a post in case others are struggling with something similar.

On lecture 36 when we implement spawn queues and the very cool circular UI, the timer portion of the UI would only update on the server side. On the client side, it always appeared full.

All other aspects of the script were working perfectly: the units spawn in the correct amount of time and the queue counter updated properly. It was just that the timer was not updating and always appeared full.

The problem? I’d attempted to be clever and cache the RTSPlayer in update, as I’d noticed Nathan had us create a variable to do so:

if(player == null)
{ 
     player = connectionToClient.identity.GetComponent<RTSPlayer>(); 
}

Of course, when called on the server, this worked fine. But as a client, there was no connection to client.

Oops!

2 Likes

Privacy & Terms