I’m finding it increasingly challenging to pinpoint the precise cause of why my network prefab is vanishing when a client initiates a connection.
Here’s a brief overview of the components in question:
1. NetworkUI (prefab): This prefab incorporates a ‘DontDestroyOnLoad’ function and contains the NetworkManagerUI (script) .
2. NetworkManager (prefab): This prefab maintains a reference to NetworkUI (prefab) .
Our NetworkUI (prefab) houses the user interface needed for establishing server connections or its own operation as a server. It’s designed to be a persistent component, hence it’s embedded into the network prefab list managed by NetworkManager (prefab) .
To ascertain if NetworkUI (prefab) is encountering an unexpected destruction, I added an OnDestroy() event listener into the NetworkManagerUI (script) . The logs point to the ‘connect button’ as the culprit.
Upon firing the client connection method, it hits the breakpoint and without delay, the destruction command is called immediately upon exiting.
Despite exploring all configuration options related to network objects and even creating a fresh Unity project, the issue persists.
Surprisingly, NetworkUI (prefab) isn’t destroyed on the server’s end. It seems when initiating a client connection, an attempt is made to spawn a clone of NetworkUI (prefab) for the client. Yet, it falters as it can’t locate it in the NetworkPrefabs list. Output: ([Netcode] Failed to create object locally. [globalObjectIdHash=2371489523]. NetworkPrefab could not be found. Is the prefab registered with NetworkManager?)
In essence, I’m dealing with a perplexing problem - the unexplained disappearance of my network prefab during client connection. Despite rigorous troubleshooting, this error remains unresolved .