Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

After creating a new empty game object in the Hierarchy tab, how to give game authority over it?

Discussion in 'Multiplayer' started by asperatology, Sep 2, 2015.

  1. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    981
    This is my current problem, which is relevant to this other problem, but not entirely the same.



    The "Input Manager" game object is just an empty game object, with a Network Identity component and a script attached to it. I have a feeling that I need to make Input Manager a "prefab", so I can either register it into the ClientScene, or register it in the Network Manager. I may be incorrect on this one.

    Is there a way not to make Input Manager a prefab, yet still allow the client / host to have authority over it?

    Thanks in advance.
     
  2. GixG17

    GixG17

    Joined:
    Aug 18, 2013
    Posts:
    105
    My understanding is that you can't.

    In a multi-player game, the server owns all. The host is considered a client so even he doesn't own any GameObject spawned by NetworkServer.Spawn() either.

    I haven't fully tested this yet but I think you have to:
    • [Command] to server
    • so that the server can [ClientCallback]
    • so that the client can handle [ClientRpc]
     
  3. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    981
    You do know I was the same guy who posted the [Command] to [Clientcallback] to [ClientRpc] that you liked, right?

    Anyway, I was told that I need to inherit Network Manager, overload some event methods, and make it so that it fits what I need to do.

    Currently, Unity 5.1 doesn't support Clients with Local Authorities over multiple prefabs. Unity 5.2 allows this, so I may need to fallback to 5.0 network code, try the 5.2 out, and decide from there. It's either that, or try writing the Network Manager subclass.