Search Unity

Parenting over network?

Discussion in 'Netcode for GameObjects' started by Chimpulous, Jul 8, 2021.

  1. Chimpulous

    Chimpulous

    Joined:
    Feb 4, 2018
    Posts:
    10
    Hi, was just wondering if there was an easy way arount parenting over a network. IE can it be done via serverRpc or ClientRpc?
     
  2. luke-unity

    luke-unity

    Joined:
    Sep 30, 2020
    Posts:
    306
    You could do it via RPCs yes. For instance you could send the id of the NetworkObject you want to parent to all the clients via a ClientRPC. There are a few problems with that approach because if a new client joins after the re-parenting it will not receive that RPC and have the wrong parent.

    We are currently working on adding a parenting feature to MLAPI which will make this much easier.
     
  3. Chimpulous

    Chimpulous

    Joined:
    Feb 4, 2018
    Posts:
    10
    thanks for your reply, I did manage to do it via clientRpc, but its nice to know its getting easier.