- Home /
Filter "Select XXX" dialog in Editor with custom code?
Is there a way to manually filter that "Select Blabla" dialog that appears when you use e.g. EditorGuiLayout.ObjectField() from code?
More precise, I want the user to be able to select MonoScript assets from all my scripts, but he should only be able to select some particular scripts (e.g. implementing some interface, containing some function etc..)
Up to now, I use dropdown boxes instead of the ObjectField which works okish for like 2-3 different scripts. But as the project grows, it would be much more preferable if I could use the unity build-in selection dialog (including preview icons, a search and so on).
Answer by Immanuel-Scholz · Jul 01, 2013 at 06:54 AM
After eating a bit of forbidden fruits, it seems to be impossible without some dark reflection magic.
I wish Unity would expose the validator function passed to DoObjectField
. If someone else is really interested in a solution, I can write some reflection-based solution together (which would probably work only until the next major unity version or so..)
For now, I just go with my ugly dropdown boxes.
Your answer
![](https://koobas.hobune.stream/wayback/20220613105200im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Are there any Editor fields which are Drag and Drop? 0 Answers
Possible to remove the Asset Browser button from an Objectfield? 0 Answers
EditorGUILayout.ObjectField cannot be changed. 1 Answer
How to optimize a custom editor ? 3 Answers
[Solved]Why doesn't my ScriptableObject based asset save using a custom inspector ? 1 Answer