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.
  2. Dismiss Notice

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:
    3,558
    Look into INetworkSerializable and send it via RPC.