Search Unity

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:
    660
    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.