#What's the capacity of registered spawnable prefabs of Network Manager?

8 messages · Page 1 of 1 (latest)

small scarab
#

My game have hundreds or even thousands of items that supposed to be spawned by NM. So I curious to know what's the capacity of NM of "Registered Spawnable Prefabs"? Can I have like 10k items added to the list? or am I supposed to use like very few template prefabs and change them once spawned, based on some script logic (to avoid 10k prefabs added) ?

unreal flower
# small scarab My game have hundreds or even thousands of items that supposed to be spawned by ...

You'll definitely want to have a small number of prefabs by type, with a NB on them with a SyncVar and hook to locally instantiate art on the clients as a child of it. PickupsDropsChilds example shows this, along with an interface for the NB on the root to engage with MonoB scripts on the child art. That also helps with pulling art from Addressables later, in case that's in your future plans.

I'd point out that networked scene objects don't need to be in that list...Mirror picks those up automatically.

You can also overide OnStartClient in your custom Network Manager and iterate prefabs in a Resources folder and pass them into NetworkClient.RegisterPrefab if you want.

#

I do RPG's, so I totally feel you. 🙂

small scarab
#

Thanks @unreal flower !
Yeah, you sound right.
However just in theory, what would you think will be a problem of having 10,000 unique spawnable prefabs? What kind of issues that may cause?

unreal flower
#

It's just a List<GameObject>, so all references. Unity will have no issue with it afaik. Mirror doesn't care.

small scarab
#

So that's being said, in terms of performance, there will be close to zero improvements of having few prefabs by type instead of 100k items? just less cleaner, etc?

unreal flower
small scarab
#

Agree! Thank you for advise!