Method with ServerCallback Attribute Works on Clients as well

Hello! I’m trying to integrate Mirror in the RPG project and wondered why this works on all clients.

[ServerCallback]
private void Update()
{
    AttackBehaviour();
}

private void AttackBehaviour()
{
    Debug.Log(name " attacked " + target.name);
}

Because the AttackBehaviour method doesn’t have any of the Mirror attributes on it, and on the ServerCallback attribute it says that this will work only on the server.

The log message on the Unity Editor (running as server Only) does print the right information relative to each client this NetworkBehaviour belongs to.
For example Player1 attacked Player2. And also vice versa if Player2 attacked Player1.

I’m just confused as how this is running and syncs across clients on the server.

Hoped someone could help me understand this
Thanks!

Privacy & Terms