Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Resolved To many prefabs, Network Prefabs List

Discussion in 'Netcode for GameObjects' started by RoWatts, Nov 14, 2022.

  1. RoWatts

    RoWatts

    Joined:
    May 5, 2022
    Posts:
    6
    We have a huge problem. (And we are very new to multiplayer and Netcode)
    We create a random arena (between 4) with random tile types. Every tile type is a prefab, so we have something like 100 (a few less) prefabs in the assets. The arena is generated server side and clients see it.

    How can we avoid adding to the Network Prefabs List, 100 prefabs (network gameObjects)?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    1,620
    How is that a huge problem?

    If this is about not wanting to do 100 drag&drop operations manually I'm certain an editor script could be written easily that does this job for you, provided those prefabs are identifiable/categorizable by name/path or base class of a script or tag or probably a couple more things.
     
    RoWatts likes this.
  3. CosmoM

    CosmoM

    Joined:
    Oct 31, 2015
    Posts:
    198
    You can also avoid this by writing your own prefab handler. See here.
     
    RoWatts likes this.
  4. RoWatts

    RoWatts

    Joined:
    May 5, 2022
    Posts:
    6
    thank you so much we're now trying these solutions :)
     
  5. RikuTheFuffs-U

    RikuTheFuffs-U

    Unity Technologies

    Joined:
    Feb 20, 2020
    Posts:
    105
    I'd also add that if the tiles are just "static" and don't really do any kind of interaction (I.E: are spawned only at the beginning of the match and are not destructible), you could avoid handling their spawn over the network to save bandwidth and instead send the IDs of the tiles to spawn, do a lookup on the client and spawn them locally