Search Unity

Question How to send a class to clients and server that does not exist as a component?

Discussion in 'Multiplayer' started by miccalisto, Apr 24, 2023.

  1. miccalisto

    miccalisto

    Joined:
    Feb 20, 2018
    Posts:
    40
    I figured a class can be send via netcode by using NetworkObjectReference if the class has a networkobject attached to it's gameobject. But what about classes that don't inherit from any behaviour and don't exist as a component in the game? That means the class is created via constructor like new Class().

    How to solve this problem, please?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,975
    Look into INetworkSerializable and send it via RPC.