I think I’ve tried just about every way to set the hideFlags on sub-assets of a prefab, but Unity always clears them when the prefab is dirtied and saved. Is there any way to get Unity to not stomp these flags? Or does anyone know where those hideFlags are being reset?
For my specific case, I’m adding a TimelineAsset
as a sub-asset of a prefab. TimelineAssets
have many hidden sub-assets (TrackAssets
, TimelineClips
, etc) that leverage the HideFlags.HideInInspector
flag to be hidden in the project view. When these are moved and end up as sub-assets of the prefab, their hideFlags are not preserved and they really clog up the project view.
I’ve tried everything I can think of to set them, including editing the *.prefab
asset directly in a text editor. While that approach does result in the sub-assets being hidden, they immediately become visible again whenever the prefab is dirtied and saved by the editor. The m_ObjectHideFlags
property of all sub-assets in the prefab asset get cleared to 0 when the asset is saved.
I think there’s maybe a chance I can use a prefab postprocessor to iterate sub-assets, check for specific sub-asset types and set their hideFlags, but that feels like a hack. Also slow.
Is there some way of accomplishing what I’m trying to do here? Or is this just completely unsupported?
Using Unity 2021.3.8f. This behavior is also present in 2023.1.0a6