Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
1
Question by supermoose · Sep 23, 2011 at 11:57 PM · editorbugonscenegui

Editor.OnSceneGUI never called.

I'm trying to understand why OnEditorGUI is never called on my custom Editor subclass.

the code is as follow:

 using UnityEngine;
 using UnityEditor;
 
 [CustomEditor(typeof(Bezier))]
 public class BezierEditor : Editor
 {
     public override void OnInspectorGUI ()
     {
         base.OnInspectorGUI ();
         Debug.Log("on inspector gui");
     }
     
     public void OnSceneGUI()
     {
         Debug.Log("on scene gui");
     }
 }

OnInspectorGUI is properly called and the debug show for it, but not for OnSceneGUI. I'm using the latest unity version (3.4.1f5)

Comment
Add comment · Show 3
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 Bunny83 · Sep 24, 2011 at 02:00 AM 0
Share

Are you sure? OnSceneGUI is only called when the sceneview is repainted...

avatar image supermoose · Oct 04, 2011 at 03:16 PM 0
Share

This seems to be a bug with the editor, on mac. For example the OnInspectorGUI function is not called for iTween Path Editor either (http://pixelplacement.com/2010/12/03/visual-editor-for-itween-motion-paths/). Is there a place to report bugs with unity?

avatar image Uniquesone · Oct 04, 2011 at 03:31 PM 0
Share

In unity go to help -> report bug

3 Replies

· Add your reply
  • Sort: 
avatar image
11

Answer by huulong · Jan 06, 2017 at 11:28 AM

Not a definitive fix, but if it happens again you can reset the editor Layout with the top-right button (for instance to Default).

I had the same issue with my custom editor and a tilemap plugin that stopped displaying its the tiling tools. Closing and restarting the editor didn't solve it. Resetting the layout solved it.

Comment
Add comment · Show 6 · 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 turbanov · Oct 31, 2017 at 05:45 PM 0
Share

Strangely this actually helped me. Weird...

avatar image smallbit · Mar 29, 2018 at 03:51 AM 0
Share

Still working in 2017.3, you saved me a lot of trouble Sir !

avatar image xtyler · Apr 26, 2020 at 06:27 AM 1
Share

This worked for me, and then it happened again a short time later! I found that resetting the layout automatically turns Gizmos visibility back on, as per @$$anonymous$$usapKahraman comment. Resetting the whole Editor Layout isn't necessary.

TL;DR Editor.OnSceneGUI only runs when scene view Gizmos is toggled on.

avatar image jBelz · Sep 21, 2020 at 10:02 PM 0
Share

Had the same bug, but this workaround still did the trick for me in Unity 2019.3.15.

avatar image huulong · Jun 04, 2021 at 08:36 PM 0
Share

Wow, I had the same issue with Unity 2021 this week and I've just found my own answer that I had totally forgotten about! And it still works!

In the meantime I sent a bug report to Unity, so now they have a sample project with a failing layout to work on. Hopefully they can fix the root of the issue even without details of how I broke the layout.

@xtyler if it happens to you regularly, try to spot the kind of GUI warnings that appear in the editor, I may add them to my bug report as extra info. Otherwise yes, you should only reset the layout if the Gizmo toggle doesn't work (in my case toggling it off and on again didn't fix the issue)

Show more comments
avatar image
5

Answer by MusapKahraman · Oct 29, 2019 at 05:17 PM

Turning the visibility of Gizmos on in the scene view worked for me. I had turned them off for some reason and OnSceneGUI stopped being called.

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 onetimepad · 2 days ago 0
Share

Yes. Problem is with Gizmos being turned off. Reopening scene window or resetting the editor Layout also reset Gizmos settings in scene window to default on.

avatar image
1

Answer by Sarseth · Jan 12, 2016 at 09:33 PM

Old question. But maybe someone find same issue. When I have "DEBUG" enabled on inspector, onGUI does not work for me either. I must disable it. I'm guessing it's a bug, cause why it would stop working?

Comment
Add comment · Show 3 · 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 giresharu · Sep 09, 2016 at 09:35 AM 0
Share

I found It continue working when I move my mouse on the scene window. BTW,it still won't work when I just put the mouse on the scene window but not move it. I don't know how to solve it. It has been FIVE year,I can't believe it is a bug. $$anonymous$$aybe there is something wrong with our codes,but we don't know.

avatar image Bunny83 giresharu · Sep 09, 2016 at 03:02 PM 0
Share

The editor is completely event driven. OnSceneGUI is only called when it should process an event. You can call SceneView.RepaintAll(); to force a repaint of all open sceneviews. Please stop posting comments on this question since you've asked your own

avatar image Bunny83 · Sep 09, 2016 at 02:59 PM 0
Share

That's not a bug. when you switch the inspector into debug mode, no custom editor will be drawn. Not even the built-in custom editors. The debug mode is just for debugging.

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

14 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

Related Questions

Unity 4.6.1f1 Editor Event.current.type not firing any command info 1 Answer

GUI & GUILayout methods no longer work in OnSceneGUI() 1 Answer

Unity Inspector Interface 5 Answers

Unity 5 editor flickering/glitchy (examples inside) 3 Answers

Adding drag function to a polygon editor 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