Skip to content

feat: Scene Registration Refactoring - New UIX Features #918

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

Closed
wants to merge 44 commits into from

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Jun 23, 2021

As described in MTT_820, there is a need to improve upon how the user registers scenes with the NetworkManager while also taking into consideration how users will associate additive scenes with a primary (root) scene. This is the second phase of the NetworkSceneManager refactoring and preparation for additive scene loading.

Currently this PR is in draft form for review purposes.

(This PR includes PR-913's changes)

This removes NetworkSpawnManager.PendingSoftSynchObjects and replaces it with NetworkSceneManager.ScenePlacedObjects.
The primary difference between the two is that the ScenePlacedObjects is populated immediately after a level is loaded or when being approved and already within the current scene.
Migrating the ScenePlacedObjects dictionary up to the rest of the NetworkkSceneManager's dictionary definitions.
Removing the PendingSoftSyncObjects dictionary from NetworkSpawnManager.
Use the ScenePlacedObjects dictionary to generate the client(s) switch scene stream buffer.

Refactored PopulateScenePlacedObjects method to not set the IsSceneObject to true and to also check and make sure the NetworkObject instance's NetworkManager reference is the same NetworkManager instance as the NetworkSceneManager's NetworkManager instance in question in order to maintain compatibility with the MultiInstanceHelper class for Mult-Instance unit tests.
A non-functional version of the SceneRegistration, SceneRegistrationEntry, and AdditiveSceneGroup assets as they would be used within the editor.  This isn't a full implementation, but just a POC.
Renaming OnSceneUnloadClient and OnSceneUnloadServer to OnClientLoadedScene and OnServerLoadedScene
Fixed some remaining checks (player prefab) as to whether the rigid body should be kinematic or not to prevent the mega spam.

During the revert changes of the NetworkTransform changes to better reflect what is in the develop branch, missed the else if.

Fixed a minor issue with the slider in the SceneTransitioning manual test to better visually reflect what the value is as well as handle the scenario if it starts at 0 boxes per second it needed to start the coroutine and if set to zero and the coroutine was running it terminates the coroutine.
This is a fix for the NetworkObjectOnSpawnTest where it was spawning a GameObject twice that contained a component that would throw an exception if you spawned a NetworkObject.
An unintended project version change
Checking to see if Yamato fails on this...
This test verifies that "cleaning in-scene placed network objects" within the connection approved method was hiding potential bugs from other unit tests.
Removing the unit test duplicated GameObject instance and all of the associated code to verify this was how the bug was missed by TestRunner and Yamato.
reverting back to the original values for these 3 files that were mistakenly committed.
This is just work in progress, need to merge 819 back into this branch.
Getting the build settings populating.  This is still wip, but is starting to populate and/or depopulate the build settings scenes list
This update handles adding or removing the associated scenes marked to auto populate the build settings when a SceneRegistration asset is assigned or deleted to/from the NetworkManager.NetworkConfig.SceneRegistration property.

This also handles only adding or removing the SceneRegistrationEntries and AdditiveSceneEntries marked to auto populate the build settings with additional consideration of AdditiveSceneGroups nested within AdditiveSceneGroups.

Auto-populating the build settings portion is still a work in progress, but is getting closer to being completed.
After reviewing my first approach, I decided that I needed to do a little refactoring that would provide the ability to have notifications on asset dependencies.
Added a new AssetDepedency class that derives from ScriptableObject and then made that the base class for SceneRegistration, SceneRegistrationEntry, and AdditiveSceneGroup.

Worked through/manually test the various combinations of adding and removing various scene registration related objects.  Still building a reference table to make sure this will cover all scenarios.

Still needs further testing.
Minor adjustments and added comments.
Fixing an issue with the SceneRegistration asset where removing it from a NetworkManager would not cause the referenced scene assets to be included.
Re-organizing naming of assets for new scene registration process in order more easily demonstrate various usages patterns.
Minor updates to names
SceneRegistration load or find the scene that contains the NetworkManager relative to the SceneRegistration asset assigned to the NetworkManager.
This use the new scene registration framework to generate the hash used to compare configurations between the client and the server.
This also has temporary SceneRegistrationEntries to assure all scenes used in TestProject are included.
Some minor refactoring along and saving the current asset states.
Working version, but too complex in a few ways.
keeping minimal scenes in build
Improved and more simplified scene registration.
NoelStephensUnity and others added 14 commits June 26, 2021 12:50
Fixing runtime compilation bugs as well as issues with losing scenes in the Build Settings during the build.
Fixing issue with having multiple assembly definitions.  The scenes were populating properly, but the test project's manual tests assembly scenes were being blown away by the primary project's assembly scenes during the build.
Duplicate entries due to bug in checking scene name against path.
Maintain the same build settings scenes in build list ordering.
This will automatically order all of the scenes so that if something is excluded and then included in the build settings scenes in build list the ordering will remain the same.
Cleaned up some of the duplicate code shared between additive scene entries and scene entries by creating a SceneEntryBase.

Include in Build property will now include/exclude a SceneEntry's reference base scene as well as the additive scene group (if assigned).

Added some demonstration purposes assets.

Cleaned up UI property order for SceneEntries.
Working well, but still **WIP**
Ended up adding a custom SceneRegistration editor to handle notifications for when list items are removed or added.
Made the SceneEntryBase implement the IAssetDependency interface in order to handle dependencies between AdditiveSceneGroup and SceneEntry.
Cleaned up some areas, but have a bunch of clean up to do (separate SceneEntry and SceneEntryBase classes from SceneRegistrationEntry).
Ran some assets through the serialization process due to the fact they were serialized with old-stale values from previous development updates.
…er.cs

Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
after demo fix.
Recursion check and AdditiveSceneGroup children refactoring to account for null entries.
Went through to re-assign scene assets to some of the SceneRegistration assets that were older versions that had lost their entries (the scenes remained in the build settings but this needed to be updated anyway).
SceneRegistraitonEditor needed to make sure the entries list was allocated before trying to assign anything.
Adding or already having assigned the same SceneAsset that also references the SceneRegistration could cause the primary scene asset (i.e. one that has the NetworkManager instance that references it) do be deleted from the list.  This fixes that issue.
This is a mid-way check-point of a new approach that utilizes the multi-scene editing design pattern to determine which additive scenes should be associated with a given SceneEntry.
Some minor debug related changes and placed holder.
LukeStampfli added a commit that referenced this pull request Jul 5, 2021
@NoelStephensUnity NoelStephensUnity deleted the feat/MTT-820 branch July 12, 2021 14:51
LukeStampfli added a commit that referenced this pull request Jul 12, 2021
 Restore testing functionality which was removed with #918 (#945)
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.

1 participant