custom ObjectField ? like @CustomEditor


Is it possible is extend EditorGUILayout.ObjectField at a very global level? just like for example we can customize a component using @CustomEditor?

I guess I am looking at something that would be called @CustomEditorField or something.

The goal behind this is for example to propose a more powerful ObjectField that would feature some tools to overcome prefabs problems when assets connection is lost.

while using a custom editor would allow me to design this, the problem is that it would not be a global custom object field and only the sctipt that I would have specifically customiozed would expose these feature. I am after customizing all object fields.

Thanks for your help,


There is no easy way to alter the global behavior of ObjectFields in this way. As you say, you could implement your own CustomObjectField type thing, but you'd have to write custom inspectors for everything to use it.

I would note, though, that the ObjectField implementation seems to be mostly implemented in managed code in the UnityEditor.dll, as one can see with a tool like ILSpy. Seeing how it works might help you work out an alternative solution.

(Also, this means that potentially, you could patch UnityEditor.dll to modify the behaviour for your Unity install, using tools like Mono.Cecil. That's some proper Here Be Dragons territory though - really not something that I'd ever recommend).