[Minor Bug] Visualization of Variable Overrides in Prefab Instances

OJuer

New member
Hi,

the custom editor of the Behaviour Tree Component does not highlight prefab overrides. Usually, Unity visualizes overrides with a bold font format and a blue line on the left side of the overridden property. This can be achieved with the EditorGUI.BeginChangeCheck() and EditorGUI.EndChangeCheck() methods.
Also, when reverting overrides using the context menu (Rightclick->Modified Component->Revert), the UI does not referesh. This might be resolved with the same method.
 
You're referring to the task inspector, correct?

This ends up being a harder problem to solve because the tasks are not Unity Objects so they don't get drawn with the usual method. The serialization data gets marked as dirty, but that doesn't directly correspond to the task. With that said, I will explore this option for version 2.
 
Hi, thanks for looking at this. I am talking about the inspector of the Behaviour Tree MonoBehaviour, specifically about the variables it lists. While the ExternalBehaviourTree has default values, the GameObject can override those. In PrefabVariants, Unity even detects the BehaviourTree Component as being dirty, the inspector just does not render it accordingly.
If you add EditorGUI.BeginChangeCheck() before rendering the lines of the variable, it should work and will even allow rightclicking a specific variable to reset the overrides of that variable. As of now, I can only reset the entire component.

1594034652665.png
 
I have to correct myself, the method that will help you render correctly is
label = EditorGUI.BeginProperty(position, label, property);
label is of type GUIContent and the return value will have the modified formatting. I think FieldInspector.DrawSingleField and FieldInspector.DrawArrayField are the places you could add this just before the calls to EditorGUILayout.FloatField() etc.

Hope this helps. Thank you for the great tool and the support.
 
Top