Have I missed something or does this lecture not actually cover the three or more player situation, where one player is eliminated but two players remain?
In my testing, after carefully following the code presented, the eliminated player can still box-select after they are dead. I was expecting to see something like a new UnitBase.ClientOnPlayerDie
action and associated disabling of the UnitSelectionHandler
when raised. Perhaps easy enough to add though, thanks to the helpful guidance of the lecture.
EDIT: actually, it’s not as easy to implement as I thought it might be. I created a new Action ClientOnPlayerDie
in UnitBase
that I subscribe to from UnitSelectionHandler
with a Client-side RPC function to invoke the Action, but unfortunately the ClientRpc or even TargetRpc calls do not wait for completion of the client function which means that the UnitBase object on the Server is destroyed before the client-side object has a chance to run the RPC function. Still trying to work out the best way to handle this, since I can’t find any function-call synchronisation mechanism in Mirror that don’t rely on the Client to respond in an particular way (therefore a security issue).