Skip to content

Commit ca676c3

Browse files
test: Companion Tests for MTT-640 and PR-749 (#754)
* NetworkPrefab registration and default PlayerPrefab This is the first pass changes required to implement MTT-640. The default player prefab is now a directly assigned value as opposed to a checkbox in the network prefab list. The default player prefab has to also be included in the NetworkPrefab list (this is so the default player prefab can be overridden too) NetworkPrefab entries can be overridden and directly assigned alternate prefabs for clients to spawn. The source prefab (what the server uses) can be a prefab reference or a prefab hash. * refactor: Naming, Migration, and PlayerPrefab This update is the first pass of making this update as painless as possible to the user by "auto-handling" the v0.1.0 NetworkPrefab pattern as well as there is additional "user-bumper" code that assures the assigned default player prefab is always in the NetworkPrefab list. * refactor: PlayerPrefab assignment Removing the auto insert within the editor and doing this at runtime. Added additional check to handle assigning the OverridingSourcePrefab if it is null and the Prefab is not. * refactor: player prefab selection and blank new entries This will prevent the scenario where a user might want to delete the default player prefab but also has it assigned within the NetworkPrefab list. This assures that a newly created network prefab list entry is blank and that there are not two entries within the list that have the same global object id hash. * style: comments just adding a few comments * style: property names and comments Adjusted names of the new NetworkPrefab properties and added additional comments to better clarify some of the "trickery" happening that will help make this a "non-breaking" feature when it comes to existing v0.1.0 NetworkConfigs and the already selected default player prefab. * refactor: Client Sync and Comments This will prevent any future client side soft synchronization issues or related issues where only one (or a few) NetworkObjects are misconfigured and the client fails to synchronize (find or instantiate). As opposed to completely breaking the rest of the pending NetworkObjects to be synchronized/instantiated, it will log an error and continue loading. This also has some additional comments and updates to comments for better clarity. * style: minor change minor change in comments * refactor: remove CreatePlayerPrefab This removes the CreatePlayerPrefab property from the NetworkConfig and from the NetworkManagerEditor. It is no longer needed as the NetworkConfig.PlayerPrefab property being something other than null tells us that the user wants to have MLAPI automatically spawn the players for them. * refactor: cleaning up using removed unused namespace references. * style: PlayerPrefab tooltip Added a tooltip for the new NetworkConfig.PlayerPrefab property * style: spaces between slashes and comment text body Added some spaces between the forward slashes and comment's text body * first pass sweep Migrating some useful elements from theScaleDemo repo into the test project for manual testing purposes. Added a samples folder with the first sample: Enalbe or Disable in-scene placed NetworkObject. Did some general clean up of the folders. * fix: clearing network prefab links This fixes an issue that can occur with serialization and NetworkPrefabOverrideLinks. The policy is to ALWAYS clear this dictionary before building the links dictionary. * fix: checking for NetworkManager Adding check for NetworkManager before trying to access it. * refactor: NetworkConfig compatibility, NetworkPrefab, and Style This removes the NetworkConfig compatibility checks that auto-upgraded a previous NetworkConfig setting to the new pattern. Updated NetworkPrefab according to this change, isPlayer is no longer needed. Added additional code to NetworkPrefab that will return a hash reflective of the override state. Adjusted some comments. * refactor: NetworkConfig compatibility, NetworkPrefab, and Style This removes the NetworkConfig compatibility checks that auto-upgraded a previous NetworkConfig setting to the new pattern. Updated NetworkPrefab according to this change, isPlayer is no longer needed. Added additional code to NetworkPrefab that will return a hash reflective of the override state. Adjusted some comments. * first pass standards clean up Did some renaming and clean up for the newly added assets. Verified working. * Adding Menu Handling for Manual Tests Some minor adjustments and asset additions that will help guide manual testing. * fix: wrong hash reference Minor adjustment for the right GlobalObjectIdHash check. * refactor: moving scripts Moving manual scripts into the default ManualTests/Scripts folder. * refactor and style Made the NetworkPrefab internal as well as NetworkPrefabOverride. Removed GetNetworkPrefabIndexOfHash and GetPrefabHashFromIndex as they were used in the old hash generation pattern. Updated comments a bit. * refactor: removing NetworkObject check Removing two checks for the failure to spawn a NetworkObject locally. This will be handled via PR-756: #756 * General Clean Up and Destroy Handling This is just some more general clean up of the names used. Also fixed some minor potential cases where destruction of objects could lead to an exception when completely exiting a scene (if there were many generic objects spawned). * More naming and comments More clean up of the migrated scripts. * Updated tags Just a minor update to the tags * refactor: removing NetworkPrefab.Hash This property is no longer being used and where it was used was replaced by the NetworkConfig.NetworkPrefabOverrideLinks * refactor and improve Added additional test in scene transitioning that registers custom prefab handler via the NetworkObject as opposed to the GameObject. Changed the mesh for each different scene transition. Third scene uses pink spheres. Expanded the MainMenuManager's scene registration to include a "scene type". A scene can either be a Selectable or IncludeOnly (i.e. you want it included but don't want it to be an option in the menu). Added additional code to handle these updates for runtime builds. Updated the SampleScene to the new NetworkPrefab pattern. * Clean Up and New SamplesMenu Did some cleaning up, adding exit buttons to all scenes, and added a SamplesMenu. This also demonstrates how the MainMenuManager works. If you open the build settings and then open the SamplesMenu you should only see the scenes included in the SamplesMenu's MainMenuManager. If you then open the MTTManualTests scene you will notice only the scenes included in the MTTManualTests's MainMenuManager are enabled. This provides a clean way to build for a specific set of scenes associated with a main menu. * refactor, fix, and updated assets A bunch of adjustments in the menu system. Added command line handling. This includes a fix for the "odd behavior" with GlobalObjectIdHash and the HandleApproval method in NetworkManager. Unity Chan animator only requires one to press "c" once and it will animate until the end of the animation. New SceneMenuReference for scenes that are sub-menus to the main menu. Some bug fixes in various places (typically on exiting a scene). * fix: assure we are creating This just fixes the fix for the weird GlobalObjectIdHash issue that only occurs under a very specific scenario. * refactor, fix, and feature Still needs review, but had a few "seemingly new" edge case scenarios pop up where editor to stand alone connections could be problematic under various scenarios where the OnValidate method could be invoked at the wrong time. Added some debug information to help narrow down when OnValidate was being invoked relative to when the GlobalObjectIdHash was being assigned. Added command line handler functionality similar to what we used in scaledemo. To test these fixes just build and run through all of the different available scenes under the following scenarios: Editor Host to stand alone build based Client Editor Client to stand alone build based Host Stand alone build based Client/Host to stand alone build based client/host. Editor Host/Client to Editor Host/Client All cases should yield no errors or invalid GlobalObjectIdHash values (especially editor to stand alone) * Finalizing Finished the scene and menu referencing pattern. Now both menu systems use the same set of code and now there is a MenuReference and SceneReference that can be used in the MainMenuManager and SceneMenuManager (which really only define the reference type to use) Minor tweaks in materials. Remove some NetworkObject related debug logging. * Fix: Additional checks for Prefabs This includes some additional checks for prefabs as well as added define for testing this specific fix regarding in-scene placed network prefabs. This includes prefab creation and unique GlobalObjectIdHash assignment checks as well. * refactor Now that we have a complete set of when to update the GlobalObjectIdHash, removing/reverting previous changes and applying much more simplified (Fatih's version) set of logic. * refactor: Remove unused dispose method. * fix: Handle scenario where no value is set for the MLAPI command. * fix globalobjectidhash in editor * remove IsTestRun flag entirely, no longer needed * minor update * refactor: GenericObject Renamed GenericObject script to GenericNetworkObjectBehaviour * refactor Removing base.NetworkStart. Co-authored-by: M. Fatih MAR <[email protected]>
1 parent abc8555 commit ca676c3

File tree

121 files changed

+22028
-738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+22028
-738
lines changed

testproject/Assets/MainMenu.unity

Lines changed: 2177 additions & 0 deletions
Large diffs are not rendered by default.

testproject/Assets/MainMenu.unity.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)