com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

Expose Network Manager Prefabs List From Internal To Public

Open CosmicStud opened this issue 3 years ago • 7 comments

Is your feature request related to a problem? Please describe. Its more so a retcon, previous versions of MLAPI had in its NetworkManager a public NetworkPrefab List. Now with the updated Netcode For GameObjects, the list has been internalized.

Describe the solution you'd like I know there is probably a reason for the hiding of the list. I am simply proposing we make the list public. With the requirement that we keep a list of network game objects in the NetworkManager, the list can get long and edited over many times through the iteration processes of development. Previously I had scripts in place that would automatically keep the NetworkPrefab list up to date per my game design. I will be using a lot of different objects. Having the list exposed will allow for more scripted and automatic opportunities, with the current way I will have to manually keep track.

Describe alternatives you've considered So far to keep up my automatic list, I have cloned the latest develop 1.0 pre.3 and edited NetworkPrefabs list to public, NetworkPrefab class public, and NetworkPrefabOverride public, thats all. Besides that, thanks everyone!

CosmicStud avatar Dec 21 '21 08:12 CosmicStud

You can still manage the list programmatically by registering the prefabs you want using NetworkManager.Singleton.PrefabHandler.AddHandler(a prefab, an handler) in a script instead of registering them using the serialized list "Network Prefabs" in the NetworkManager editor.

WhippetsAintDogs avatar Dec 21 '21 18:12 WhippetsAintDogs

You can still manage the list programmatically by registering the prefabs you want using NetworkManager.Singleton.PrefabHandler.AddHandler(a prefab, an handler) in a script instead of registering them using the serialized list "Network Prefabs" in the NetworkManager editor.

I gotcha, in my case I am already utilizing the prefab handler for object pooling. But for cases like scene networked objects, player prefab, or any other objects that aren't being added to the prefab handler and Netcode automatically handles it, it'd just be nice if I could access the global network objects on the server for synchronicity purposes

CosmicStud avatar Dec 22 '21 02:12 CosmicStud

Echoing the intent of this request, I'd love the prefab list to be readable as well, so I don't have to keep a duplicate copy of the data in sync with Netcode's, which may be error prone and is a duplication of effort/resources really (you've already got it).

If exposing the list as public is a no-no, please at least consider exposing the data as read-only public. I assume additions and removals should always go through network manager's add/remove methods, which is why the list isn't exposed currently.

scott-lin avatar Jun 28 '22 19:06 scott-lin

Lol, I concur! Add Netcode as a package through github, and change the NetworkPrefab class from internal to public, do the same for the enum NetworkPrefabOverride, and the NetworkConfig NetworkPrefabs list to public. That way you dont have to have two separate data structures to work on

CosmicStud avatar Jun 28 '22 23:06 CosmicStud

Hopefully they can still see this

CosmicStud avatar Jun 28 '22 23:06 CosmicStud

Add Netcode as a package through github, and change the NetworkPrefab class from internal to public

I'd rather the change be official, so I don't have to manage a private change as Netcode releases more versions.

scott-lin avatar Jun 29 '22 02:06 scott-lin

+1

cmlewis89 avatar Jul 16 '22 00:07 cmlewis89

+1

chromee avatar Oct 04 '22 10:10 chromee