Skip to content

fix: NetworkObject parenting support in scene transitioning #1148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 7, 2021

Conversation

NoelStephensUnity
Copy link
Collaborator

MTT-621
This fixes the issue with parented NetworkObjects being removed from their parent during scene transitions (i.e. a Scene loaded in single mode).

This allows for parented NetworkObjects to properly transition between scenes as well as disables the NetworkObjects during a scene transition (i.e. loading a scene in single mode) until the scene has been loaded right before the NetworkObjects are moved back into the newly loaded currently active scene.
After consulting and verifying fix with Fatih, there was some refactoring to assure only non-parented GameObject transforms were migrated as all children would follow.  Additionally changed the name from MoveObjectsToScene to MoveObjectsFromDontDestroyOnLoadToScene for better clarity of what the method did.
@NoelStephensUnity NoelStephensUnity changed the title Fix/parenting scene transitioning fix: parenting scene transitioning Sep 7, 2021
@NoelStephensUnity NoelStephensUnity changed the title fix: parenting scene transitioning fix: MTT-621 - parenting scene transitioning Sep 7, 2021
@NoelStephensUnity NoelStephensUnity changed the title fix: MTT-621 - parenting scene transitioning fix: parenting scene transitioning Sep 7, 2021
@0xFA11 0xFA11 changed the title fix: parenting scene transitioning fix: NetworkObject parenting support in scene transitioning Sep 7, 2021
fixing the clarity of one comment.
@NoelStephensUnity NoelStephensUnity merged commit b6937e8 into develop Sep 7, 2021
@NoelStephensUnity NoelStephensUnity deleted the fix/parenting-scene-transitioning branch September 7, 2021 22:21
SamuelBellomo added a commit that referenced this pull request Sep 13, 2021
…nsform

* develop:
  fix: add `link.xml` to prevent IL2CPP stripping `Unity.PerformanceTesting` (#1172)
  chore: add boilerplate for `ClientNetworkTransform` sample (#1168)
  chore: remove `ClientNetworkVariable` (#1167)
  chore: Disable test while we reevaluate the assumption that INetworkM… (#1163)
  docs: rename Manual.md to Index.md
  Only track one metric for scene sync and do not report scene name (#1159)
  test: create job definitions for mobile build and test (#1152)
  test: make test runner scene ignored by default for BaseMultiInstanceTest (#1154)
  fix: remove left-over reference to SyncTransform (#1155)
  chore: remove unused SyncTransform.cs (#1153)
  chore!: remove NetworkNavMeshAgent (#1150)
  fix: NetworkObject parenting support in scene transitioning (#1148)
  chore!: rename Prototyping asmdef to Components (#1145)
  feat: add bootstrap sample to package (#1140)
  chore: remove `--yamato` param from `standards.py` (#1144)
  fix: MTT-504 connection approval messages and comparing networkconfig (#1138)
  refactor!: remove NetworkChannel and MultiplexTransportAdapter (#1133)

# Conflicts:
#	com.unity.netcode.gameobjects/Components/Interpolator.meta
#	com.unity.netcode.gameobjects/Components/Interpolator/BufferedLinearInterpolator.cs
#	com.unity.netcode.gameobjects/Components/Interpolator/BufferedLinearInterpolator.cs.meta
#	testproject/Assets/Prefabs/PlayerCube.prefab
mollstam pushed a commit to Keepsake-Games/com.unity.netcode.gameobjects that referenced this pull request Feb 13, 2023
…chnologies#1148)

* fix

This allows for parented NetworkObjects to properly transition between scenes as well as disables the NetworkObjects during a scene transition (i.e. loading a scene in single mode) until the scene has been loaded right before the NetworkObjects are moved back into the newly loaded currently active scene.

* refactor

After consulting and verifying fix with Fatih, there was some refactoring to assure only non-parented GameObject transforms were migrated as all children would follow.  Additionally changed the name from MoveObjectsToScene to MoveObjectsFromDontDestroyOnLoadToScene for better clarity of what the method did.

* style

fixing the clarity of one comment.
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.

2 participants