Skip to content

fix: NetworkSceneManager add do not load during callback note in xml documentation [MTT-3495]#1974

Merged
NoelStephensUnity merged 5 commits intodevelopfrom
fix/mtt-3495-networkscenemnager-xml-documentation-add-do-not-load-during-callback-note
May 17, 2022
Merged

fix: NetworkSceneManager add do not load during callback note in xml documentation [MTT-3495]#1974
NoelStephensUnity merged 5 commits intodevelopfrom
fix/mtt-3495-networkscenemnager-xml-documentation-add-do-not-load-during-callback-note

Conversation

@NoelStephensUnity
Copy link
Copy Markdown
Member

This pertains to #1942 and was determined that the API documentation needs to be updated to let users know not to start new scene events within a scene event callback. This PR adds the additional XML documentation.

MTT-3495

Testing and Documentation

  • Includes additions to existing public API documentation.

xml documentation to be included in API documentation that one should not try to start a new scene event within a scene event notification callback.
one more location just to make sure.
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner May 16, 2022 22:16
/// delegate type <see cref="NetworkSceneManager.SceneEventDelegate"/> uses this class to provide
/// scene event status.<br/>
/// <em>Note: This is only when <see cref="NetworkConfig.EnableSceneManagement"/> is enabled.</em><br/>
/// <em>*** Do not start new scene events within scene event notification callbacks.</em><br/>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have (or is there) any mechanism to detect and prevent such scene events ?

Copy link
Copy Markdown
Member Author

@NoelStephensUnity NoelStephensUnity May 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why yes there is!
Both NetworkSceneManager.LoadScene and NetworkSceneManager.UnloadScene return a SceneEventProgressStatus.
If you invoke that in the middle of a scene event NetworkSceneManager will return SceneEventProgressStatus.SceneEventInProgress which tells/reminds the user "You are in the middle of a scene event, let it finish completely before trying to start a new one".
The same thing would happen if you tried to load (n) scenes all at the same time and called NetworkSceneManager.LoadScene within some method. The first call (iteration 0) it would return SceneEventProgressStatus.Started and then for every other call (up to n) it would return SceneEventProgressStatus.SceneEventInProgress.

So, this is PR is just to remind users when they are looking through the API that you can't start a new scene event until any current scene events are still in progress.

Comment thread com.unity.netcode.gameobjects/Runtime/SceneManagement/NetworkSceneManager.cs Outdated
…ceneManager.cs

Co-authored-by: Fatih Mar <mfatihmar@gmail.com>
@NoelStephensUnity NoelStephensUnity enabled auto-merge (squash) May 16, 2022 23:37
NoelStephensUnity and others added 2 commits May 16, 2022 21:53
This should fix the edge case scenario exposed on Mac Desktop.
This PR originally only modified comments, but it continued to fail in the one spot we were not using a WaitForConditionOrTimeOut.
@NoelStephensUnity NoelStephensUnity merged commit c09a3de into develop May 17, 2022
@NoelStephensUnity NoelStephensUnity deleted the fix/mtt-3495-networkscenemnager-xml-documentation-add-do-not-load-during-callback-note branch May 17, 2022 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants