Open KreutzerCode opened 4 months ago
Hi @KreutzerCode,
My assumption is that the NetworkList is on an in-scene placed NetworkObject
since dynamically spawned NetworkObject
s get automatically destroyed on the client side?
Hi @NoelStephensUnity
That is correct. It is a “GameManager” game object that is loaded in the first scene of the game, this game object is DontDestroyOnLoad and accompanies the player throughout the game.
@NoelStephensUnity is this part of the answer to my question? If so, I would appreciate a brief explanation of the process ^^
@KreutzerCode 😸 Sorry about that... I was looking into the adjustments needed for this and ran into the divide between in-scene placed and dynamically spawned...which was (if memory serves) part of the reason to not provide this functionality due to the distinct differences between in-scene placed and dynamically spawned objects.
Since this kind of functionality would only apply to in-scene placed NetworkObjects and any pooled NetworkObjects used for dynamically spawning, I need to run through a review process for this kind of change.
My recommendation (for now) would be to use the "hybrid approach using dynamic spawning of a non-pooled network prefab" where your in-scene placed NetworkObject is (if not already) converted to a network prefab and then in place of the in-scene placed GameManager you have a "GameManagerSpawner" that dynamically spawns the GameManager.
This way when the game session completely ends there are no remaining artifacts (if that is an issue for your project).
If not... and you were truly curious as to why you can't do this... it was a decision made like 2+ years ago that I think deserves to be revisited but (unfortunately) it will be awhile as it does require an internal review process and then scheduling for this.
@NoelStephensUnity Okey thanks for the detailed description and the solution approach! I will take this condition into account next time. For my project it is already quite unfavourable to destroy the complete object when i want to get rid of the networklist content. But I already have a dirty hack around it.
Just for my interest, will this behaviour be changed in the future as you described?
The issue can therefore be closed. Thanks again!
Setup: Unity 2023.2.7f1 Netcode for Gameobjects v1.8.1
Question: Hi, I have a simple but confusing question about NetworkList variables. When I was testing the state of my clients when they connect and disconnect a game, I noticed something strange regarading the data of the NetworkList.
Steps:
Now the client can still read the data of the old game session from the NetworkList, but it cannot clear the list because of missing permissions and remains stuck with the old session data. The data is only overwritten when the client joins a new session as a client or host.
I have looked at the documentation and implementation of Networklist and have come to the conclusion that this is an intended behaviour. My question is WHY, and how is it intended to get rid of the old session data when offline?
TLDR: The client cannot delete old data from the NetworkList when the connection to a session is terminated.
If I have overlooked something or am still missing important information to understand my question, please let me know. Many thanks in advance!