Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Unity Multiplayer [Server] vs isServer

Discussion in 'Multiplayer' started by Deleted User, Jul 1, 2015.

  1. Deleted User

    Deleted User


    What is the difference in using the [Server] attribute vs having the following at the top of a function?

    if (!isServer)
  2. Necromantic


    Feb 11, 2013
    isServer is obviously more flexible because you can separate parts of a method while the ServerAttribute affects the whole method. Unless you use the ServerCallbackAttribute the ServerAttribute will also throw a warning to the console when the method is called on a client.
    So if you are really just returning immediately if it's not run on the Server one of the Attributes is probably the better choice. It also makes that design choice more visible.
    Deleted User likes this.