Skip to content
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

fix: GlobalObjectidHash serializing invalid values [MTT-77098] #2662

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Aug 14, 2023

This PR resolves several issues with the generation of the GlobalObjectIdHash value:

  • When editing a prefab, it was possible that an invalid GlobalObjectIdHash value could be serialized.
    • This invalid value could "hide itself" as viewing the prefab asset in the inspector view, when no longer editing the prefab, would show a valid value but the previous invalid serialized value would still be applied in playmode and/or runtime builds.
      • A work around would be to revalidate each (network) prefab that this could have happened to.
  • When creating a prefab from an in-scene placed object, the current recommended next action would be to delete the original in-scene placed object and create a new instance of that object from the newly created prefab.
    • This extra step was a work around for an issue directly related to how the prefab was being generated and updated.
  • Depending upon the scenario, it was possible for a GlobalObjectIdHash value to be updated but the asset not marked as being dirty.
    • This could impact multi-editor based sessions (MPPM, Parrel Sync, etc.) where instances would not be updated to the changed GlobalObjectIdHash value.
    • This was also a part of the issue related to the above described issues.

MTT-7098
fix: #2653
fix: #1499
fix: #2664

Changelog

  • Fixed: Issue where generation of the DefaultNetworkPrefabs asset was not enabled by default.
  • Fixed: Issue where the GlobalObjectIdHash value could be updated but the asset not marked as dirty.
  • Fixed: Issue where the GlobalObjectIdHash value of a (network) prefab asset could be assigned an incorrect value when editing the prefab in a temporary scene.
  • Fixed: Issue where the GlobalObjectIdHash value generated after creating a (network) prefab from an object constructed within the scene would not be the correct final value in a stand alone build.

Testing and Documentation

WIP:
So far this user suggested fix looks promising. Creating a prefab from within a scene no longer requires one to delete the original (in-scene) object and then create a new instance from the newly created prefab.  It also is automatically detected and added to the default prefabs.

Still needs further testing and investigation.
Minor rename of a variable.
Updated comments for further clarification as to what is happening.
Fixing issue with namespace being outside of the UNIT_EDITOR conditional and removed an unused private property.
Fixing issue with PrefabStageUtility not existing in the same namespace based on Unity editor version.
left out #endif
Exposing GlobalObjectIdHash when in the editor and not in play mode.
This reverts commit c1eda40.
Adding method to expose GlobalObjectIdHash for manual testing purposes.
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review August 25, 2023 00:12
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner August 25, 2023 00:12
Make sure the default network prefabs list is generated automatically by default.
adding change log entries
adding one more entry
Attempting to fix the issue with TransformInterpolationTests stability.
Really, this test should be re-written.
Wrong type of adjustment...
@NoelStephensUnity NoelStephensUnity enabled auto-merge (squash) August 25, 2023 19:23
@NoelStephensUnity NoelStephensUnity merged commit d379198 into develop Aug 25, 2023
22 of 23 checks passed
@NoelStephensUnity NoelStephensUnity deleted the fix/globalobjectidhash-serializing-invalid-values-mtt-77098 branch August 25, 2023 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants