So I created a custom Editor that ABSOLUTELY must be a GameObject editor, I.E. it replaces the base editor for GameObjects.
I used the OnInspectorGUI override and base.DrawDefaultInspector() to get the default inspector back.
However I cannot for the life of me get the preview to show up, and it even makes the preview icons turn back into blue boxes.
So far I have tried the following thiongs.
Attempted to draw a custom preview, no success without drawing a literal custom preview, this will never bring icons back.
Tried including the base.OnPreviewGUII.
Tried including the base.OnInteractivePreviewGUI.
Tried including the base.OnPreviewSettings.
Tried using OnGUI to draw the preview from editor... still no luck.
Tried incorporating ALL of the above at once, no luck.
Any ideas? People are going to be very unhappy when they realize that my extensions does not show preview GUI.
Any thoughts? @Bunny83
Answer by Adam-Mechtley
Jan 20 at 07:19 PM
Please see my answer here.
The problem is that you need to re-implement Editor.RenderStaticPreview(). Simply calling the base implementation will not help you because you are not inheriting from the built-in GameObjectInspector class, but simply Editor, which will just draw a cube icon instead of a preview of the renderers.
The best workaround for now is to create an instance of the built-in GameObjectInspector (via reflection) using your same targets in e.g., OnEnable, and call RenderStaticPreview on this instance and return its result in your method.
Answer by startassets
Mar 12 at 07:46 PM
@RobAnthem I've just finished my own preview asset, maybe it will be useful for you: https://forum.unity3d.com/threads/powerful-preview.460157/
This seems more like an advertisement...
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
119 People are following this question.
TexturePropertySingleLine in Editor class
Custom Inspector Preview Buttons
How to show type text in EditorGUI.ObjectField?
Change the target of inspector from script
Hierarchy in editor