- Home /
custom ObjectField ? like @CustomEditor
Hi,
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,
Jean
Answer by superpig · Apr 22, 2011 at 12:53 AM
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).
Hi, thanks for the tips, tho as you say far to complex, don't want to go down that road, it doesn't worth it really.
Your answer
Follow this Question
Related Questions
how can I create a new Object from custom Editor 0 Answers
How do I make fields in the inspector go bold when prefab value is overridden 4 Answers
'type mismatch' at custom inspector .asset 0 Answers
Automatically increment an integer field in a bunch of prefab gameobjects in the unity editor. 0 Answers
MonoBehaviour Properties not saving their values from Editor 2 Answers