- Home /
Question by
MrKich · Apr 09, 2017 at 05:31 AM ·
c#networkingrpcinheritance
Using command attribute in child classes
Let's assume I have following classes:
public abstract class BaseClass : NetworkBehaviour{
public abstract void CmdMakeAction();
}
public class Derived : BaseClass {
[Command]
public override void CmdMakeAction() {
if (!isServer) {
Debug.Log("WRONG! Executing CmdMakeAction on client!");
}
}
}
The problem is that it looks like unity is executing CmdMakeAction not only on server, but on clients too.
However, if I remove CmdMakeAction from abstract class and remove "override" keyword from Derived, then things begin to work.
Is this my error somewhere [I am coding almost 16 hours =( ] or is it well-known behavior?
P.S. Unity version is 5.6.0f3
Comment