I am having a difficult time setting up AI units in my multiplayer networked game. Ultimately, I intend to run the movement logic for all AIs in my game on the server only, and update the clients via an attached network transform component.
I have attempted to use a [Server] attribute on the code being run on my AI units. However, when running a client connected to a built server instance in the Unity environment, I get a series of warnings that a [Server] function was called on a client, which leads me to believe that the [Server] attribute isn’t really stopping code from being run on clients.
I’ve also attempted to use the function Network.isServer, and Network.isClient attached to the code in my AI characters to make a distinction between objects on servers and clients, but they always return false in all cases. The documentation on these two functions is somewhat lacking, so I’m not really certain if this is the proper way to utilize them anyway.
What is the most common method of discerning between Server and Client instances in Unity Networking? Are there other functions or methods for this purpose besides what I have referenced here?