Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Start Client not instantiating Player prefab

Discussion in 'Netcode for GameObjects' started by lazy_clap, Oct 20, 2023.

  1. lazy_clap

    lazy_clap

    Joined:
    Jul 9, 2021
    Posts:
    7
    Hi,

    im working on making a networked first person dodgeball game and i have set up my game with netcode for unity objects. i have my network manager and a separate menu scene where i have mirrored the functionality of the inspector buttons, start host and start client. These work fine, and i have validated this. I am able to create a host with no issues using a separate build and then when i click start client (even from within the inspector), my second player shows up in my host's game as expected.

    However even though the client is connected to the host, on the client's game (in my case the editor) there is no player prefab that has been instantiated by the network manager.

    To pre answer some questions i would ask if i was tyring to help myself:
    1.) Yes i create the host first, before i click start client
    2.) yes i have tried with both my menu start client button and the built in button in the inspector
    3.) yes the menu is on a separate scene, but again even on the client i can see scene switching is working as it loads my game scene
    4.) yes i have tried both ways around, as in starting client in the editor version and the build version

    I'm just not sure why it is connecting the client to the host but then not giving the client a player prefab to control. my understanding is that the network manager object spawns the player prefab in. This is how i am creating the player for the host so i don't see why it would be any different for the client, especially as far as the host game is concerned the client is connected.

    any help would be greatly appreciated

    thanks