Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    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:
    6,550
    Look into INetworkSerializable and send it via RPC.