- Home /
Custom editor window does not show prefab overrides
Hiho.
We have written a custom Tranform inspector with a few useful buttons. However, when modifying a prefab instance, this inspector does not show the bold override text, and does not mark the override with the blue line on the left side, they can only be seen in Debug mode.
How do we need to modify the script to support this vital functionality?
Thanks!
Answer by Bunny83 · Jan 22, 2021 at 12:53 PM
Well, what exactly are you expecting as answer? You clearly did not pay attention to prefab overrides and maybe even forgot about multiobject editing. How should we know what you did in your custom inspector? All we can see is that you did not implement it properly.
For those functionalities implementing some context menu buttons may make more sense. The transforminspector is a quite complex beast. For example in animation edit mode the captured field are usually marked red.
Well, a pointer to some ressources or documentation regarding these features would be nice, as I did not find any, not even in the official documentation pages that deal with custom editors.
And it's not limited to the Transform inspector - ANY custom inspector that you want to have the same look-and-feel as "official" inspectors will need to take care of this.
Is it simply a certain command/check that needs to be added ("if(isPrefabOverride(EditorGUIObject))..."), or does everybody who wants to create any custom inspector have to take care of all of these issues from scratch, and re-implement the wheel each time ("private void DrawOverrideLineOnLeftHandSide(){ // some GL commands... }")?
Answer by Eck · Feb 11, 2021 at 04:30 PM
I just ran into this problem too @Wolfram.
Apparently there's a EditorGUI helper BeginProperty/EndProperty that you need to wrap properties in. This will show the bolded labels for overridden prefab properties. This post goes into a little more detail: https://forum.unity.com/threads/solved-c-custom-property-drawers-label-text-not-showing.771122/.
Eck.
Your answer
Follow this Question
Related Questions
How to Hide/Show List or Array in the inspector based on a variable? 0 Answers
Dictionary becomes null unexpectedly when using a custom inspector 2 Answers
Events in custom inspector 1 Answer
Getting a target's gameobject in custom editor 1 Answer
Custom editor values set in prefab editor not set in prefab asset 0 Answers