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

Skip warning of missing entity referenced from sort order component #15827

Merged

Conversation

michabr
Copy link
Contributor

@michabr michabr commented Apr 27, 2023

What does this PR do?

Add an option to skip serialization warning when an entity reference does not match any registered entities. Skip these warnings when serializing the sort order component because undoing prefab overrides may leave stale entity Ids in the sort order array.

Fixes #15652

How was this PR tested?

Tested in Editor using repro steps in ticket.

Signed-off-by: michabr <82236305+michabr@users.noreply.github.com>
@michabr michabr requested review from a team as code owners April 27, 2023 17:50
Copy link
Contributor

@forkercat forkercat left a comment

Choose a reason for hiding this comment

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

looks good:)

Comment on lines 132 to 134
// to be added back to the parent's sort order array
AZ::JsonEntityIdSerializer::JsonEntityIdMapper** idMapper =
context.GetMetadata().Find<AZ::JsonEntityIdSerializer::JsonEntityIdMapper*>();
Copy link
Contributor

@forkercat forkercat Apr 27, 2023

Choose a reason for hiding this comment

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

Feels like we can link to some GHIs related to this for better reference:

#15652
#15099
#13437

Comment on lines 128 to 132
// So when an entity is added/removed as a prefab override, two separate overrides are
// generated, one referencing the child and one referencing the parent.
// Reverting prefab overrides only affects one entity at a time, so reverting overrides on
// a parent whose child was deleted as an override would cause the deleted child's entityId
// to be added back to the parent's sort order array
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Instead of giving a very specific repro case here, it's better to keep it general since the warning was previously being sent anytime it can't resolve an entity id reference.
Something like "Since sort order component on an entity stores a vector of child entity ids in it, it's possible for the component to be left with stale entity ids when updates on child entities don't update the parent entity's sort order component. To reduce the noise in error log, we are allowing the component to have stale entity ids."

Signed-off-by: michabr <82236305+michabr@users.noreply.github.com>
@michabr michabr merged commit 49947a0 into o3de:development May 1, 2023
3 checks passed
@michabr michabr deleted the michabr/prefab_sort_override branch May 1, 2023 16:52
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.

Error dialog after reverting overrides on a parent
5 participants