Search Unity

Question why push the player prefab in NetworkPrefabs List ?

Discussion in 'Netcode for GameObjects' started by wanglong-2016, Oct 3, 2022.

  1. wanglong-2016

    wanglong-2016

    Joined:
    Jun 18, 2017
    Posts:
    5
    I learn NetCode and running "2DSpasceShooter ",well,run this nothing problem. then I delete the "Ship"prefab NetworkPrefabs List ,then build it again, run it in server mode and host mode . I found nothing problem too.
    So ,why the example of NetowrkManager push the "Ship" prefab in NetworkPrefabs List? the document so simple can't understand it .............but, "Bullet"、"Powerup"、"Asteroid" are the server create Objects ,and need NetworkPrefab ,but "Ship" really need that?
     
  2. wanglong-2016

    wanglong-2016

    Joined:
    Jun 18, 2017
    Posts:
    5
    It is the pictrue ...
     

    Attached Files:

  3. lavagoatGG

    lavagoatGG

    Joined:
    Apr 16, 2022
    Posts:
    229
    If you delete the ship prefab from the network prefab list it will work on host but not on clients. The clients need to know what object to spawn as their player when they connect
     
    CreativeChris likes this.