Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by RobAnthem · Jan 20, 2017 at 05:30 PM · guieditorinspectoreditor-scriptingpreview

Get default preview for GameObject Editor

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

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Adam-Mechtley · Jan 20, 2017 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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RobAnthem · Mar 24, 2018 at 06:06 PM 0
Share

This actually worked to get the icons back, but I still can't get the preview box to render a preview of the object like it should for 3d objects. I know how to render a new preview of the object, but this won't replace the existing preview window, it just adds another preview and I'm stuck with a broken preview below it.

avatar image
0

Answer by startassets · Mar 12, 2017 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/

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RobAnthem · Mar 17, 2017 at 02:51 AM 0
Share

This seems more like an advertisement...

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

114 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

TexturePropertySingleLine in Editor class 0 Answers

Custom Inspector Preview Buttons 0 Answers

How can i get SerializedProperty from UnityEvent which in List. Sorry for my Eng. 2 Answers

How to show type text in EditorGUI.ObjectField? 1 Answer

Custom Editor GUI Elements 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges