Editor entity visibility is broken #18469
Labels
kind/bug
Categorizes issue or PR as related to a bug.
needs-triage
Indicates an issue or PR lacks a `triage/foo` label and requires one.
sig/content
Categorizes an issue or PR as relevant to SIG Content.
Describe the bug
After turning off an entity visibility in the editor the entity appears in white.
Assets required
A level with a textured multi-entity prefab with LODs. The default level is fine. Add multiple textured complex prefabs with entity hierarchy to have the scroll bar in the entity outliner.
Steps to reproduce
Expected behavior
The entity disappears.
The entity outline scroll position is intact.
Actual behavior
The entity disappears for a brief moment of time, then reappears with white materials.
The entity outliner scroll position is changed.
Screenshots/Video
Additional context
It looks like there is a design flaw in the undo system. The problem can be fixed by commenting out this line
AzToolsFramework::ScopedUndoBatch undo("Toggle Entity Visibility");
The undo system recreates dirty entities (affected in the scope of the undo object) and all their components. The material component resets the materials,, which is probably OK, that’s why we have it in white. On the new components activation the entity is set as visible because the mesh component knows nothing about the editor visibility component that keeps the editor visibility flag. I tried adding Activate() to the editor visibility component to apply the editor visibility flag, but that cannot fix the problem because the editor visibility component activates before the others, it cannot change the visibility because there are no bus subscribers yet.
In general the entity reset seems not the best idea to me. In addition to the visibility issue it produces annoying entity outline scroll position change.
The text was updated successfully, but these errors were encountered: