- Home /
Should I use Inspector or custom editor window?
I am creating a character dev system and would like to know if I should use the inspector or a customised window. It will be used to morph the character, select clothing and accessories and other things. These will also need to be accessed during runtime through an API.
Any advice would be great :)
If you want them to be used in runtime I'd use inspector.
I mostly use custom windows for optimizing code generators, single use generators (e.g. creating an prefab with certain classes and settings, shader generators etc.)
But it's what you'll prefer to do.
Answer by Bunny83 · Nov 09, 2016 at 12:29 PM
This question is actually a bit "vague" as it highly depends on the actual actions you want to perform and how many objects are involved.
I'm not sure how this is actually relevant here:
These will also need to be accessed during runtime through an API
Custom inspectors as well as editor windows are pure editor classes which don't exist at runtime at all. Where and how you store your data is a completely different topic.
In general it's recommended to use:
a custom inspector when you only work on a single object. A good example is Unity's terrain editor which is implemented in a custom inspector. Keep in mind that when you "deselect" that object the inspector will be gone. This makes it difficult when working with several objects / assets.
an editor window when you want to have some sort of wizard or simply a more complex setup. In more complex systems you usually use both, an editor window as well as some custom inspectors. The editor window would represent your actual "workspace". Now you can select (either manually or semi-automatic) other objects / assets which will now show up in the inspector for editing. A good example here is the Mecanim editor or the Animation editor. Those require constantly selecting / dealing with other objects and thus a custom inspector would be a bad choice.
So it all boils down to how many objects are involved.
Also keep in mind that the inspector window is usually a rather narrow, tall window, so it's difficult to display things that require a certain width. Having to resize the inspector to display all your content is a good indicator that you might want to use a seperate editor window instead.
Generally it doesn't matter. It's always a question about usability, graphical interface design and the workflow idea. If you want to create this to sell or distribute to other users you might want to stay as close to the basic workflow Unity uses itself.
That was really insightful and has helped out alot. I understand your runtime comment, I didn't think that part through very well. You have made it clear to me what I should be doing to accomplish my goal. Thanks heaps man.
Your answer
Follow this Question
Related Questions
Calling a custom inspector from an editor window of an instance of a class 1 Answer
Disable input to inspector drawn underneath 1 Answer
Custom tree-like editor 0 Answers
Custom Inspector "Multi-object editing not supported" 4 Answers
How to Hide/Show List or Array in the inspector based on a variable? 0 Answers