fix: Handling empty network prefab entries during NetworkManager.Init - #818
Merged
NoelStephensUnity merged 7 commits intoMay 10, 2021
Merged
Conversation
0xFA11
reviewed
May 9, 2021
| // Provide the name of the prefab with issues so the user can more easily find the prefab and fix it | ||
| UnityEngine.Debug.LogWarning($"{nameof(NetworkPrefab)} (\"{NetworkConfig.NetworkPrefabs[i].Prefab.name}\") will be removed and ignored."); | ||
| // Don't try to name the prefab if it doesn't exist | ||
| if (NetworkConfig.NetworkPrefabs[i] != null && NetworkConfig.NetworkPrefabs[i].Prefab != null) |
Contributor
There was a problem hiding this comment.
huh? we are already in if (NetworkConfig.NetworkPrefabs[i] == null || NetworkConfig.NetworkPrefabs[i].Prefab == null) scope by now, see line 405
probably, there should be a better fix or logic flow here.
Member
Author
There was a problem hiding this comment.
Yeah... it doesn't need to be there at all. Removed it completely.
0xFA11
approved these changes
May 10, 2021
Cosmin-B
approved these changes
May 10, 2021
NoelStephensUnity
enabled auto-merge (squash)
May 10, 2021 20:27
NoelStephensUnity
deleted the
fix/NetworkManager-Init-NetworkPrefab-Error-Fix
branch
May 10, 2021 21:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a network prefab is null, then it needs to only warn of the null network prefab and add it to the list of network prefabs to remove, but not try to display the non-existent prefab's name (which can cause an assert and break the initialization process).
This was found while helping with the BossRoom upgrade to MLAPI develop branch.