When to decorate with Client

At 11:53 in the video we are setting up OnStartClient and OnStopClient for the unit class, and making sure that the connection is for a client and not the host.

What is the reason that these methods are in the client section but not decorated with [Client]?

OnStartClient and OnStopClient are callbacks that are only called on the client by default. That logic is built into Mirror. They will never be called in the client context, so there is no need to add the additional attribute of [Client] in front of them. You could probably add the attribute if it makes your code clearer to you and it should work fine!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms