Search Unity

  1. We have added sub-forums for the experimental MLAPI and Unity Transport Package. Please use the new forums to discuss related topics.
    Dismiss Notice
  2. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  3. Dismiss Notice

Help Wanted [MLAPI] Distinguish between Client and Server when Hosting

Discussion in 'MLAPI' started by PeterPursuit, May 25, 2021.

  1. PeterPursuit

    PeterPursuit

    Joined:
    Jan 30, 2017
    Posts:
    1
    Hello there! I can't get my head around the following situation. Hopefully someone can share some wisdom.

    My scene has a bunch of cubes in it with the same movement script on each cube. The script checks if IsOwner == true and then gets Key Input to move the cube. By default all cubes are owned by the server. The server then gives each client ownership of one (or more) cubes. In each instance of the game where I connect as a client I can move around those cubes with given ownership. In the host instance I also move all cubes that are owned by the server. Well, kinda makes sense since a host is client and server at the same time.

    So the question is how do I run client only code and server only code when I'm hosting? Does this even make sense or am I approaching it wrong?
     
unityunity