Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Could not get NetworkObject for the NetworkBehaviour. Are you missing a NetworkObject component?

Discussion in 'Netcode for GameObjects' started by Deleted User, Mar 18, 2022.

  1. Deleted User

    Deleted User

    Guest

    I want to use this to make a lobby system.When a client create a room, a room will be spawned.The room has a button component, when a client click it, he will join this room.But I clicked it, the error occured.The room prefab has the click event.I think the NullReferenceException result in the error, but I have no idea to solve this.
    upload_2022-3-18_14-49-43.png
    upload_2022-3-18_14-51-16.png
     
    emilnyberg116 likes this.
  2. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    700
    I'm guessing but, does the RoomCreator gameobject have a NetworkObject component, as it looks like it's handling the click event.
     
    emilnyberg116 likes this.
  3. Deleted User

    Deleted User

    Guest

    Yes,I have found the problem.Thank you.
     
    emilnyberg116 likes this.