Hi,
What’s the difference between [Server] and isServer?
Thanks
Hi,
What’s the difference between [Server] and isServer?
Thanks
The [Server] attribute is added to member functions in NetworkBehaviour classes to make them run only on servers, while the isServer flag is used to check if you are running on a server. They are complementary and usage of one versus the other really depends on the specifics.
[Server] just adds the following code to the function during build
if (!NetworkServer.active)
{
Debug.LogWarning("[Server] function 'System.Void TestClass::TestFunc()' called on client");
return;
}