Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 hexdump · Apr 12, 2013 at 10:28 AM · editorwindoweditor window

Manual repainting not working in a custom editor

Hi!,

After reading some answers about forcing repainting in a unity3d editor and realizing they do not work for me I have written a little example:

 [CustomEditor(typeof(LocalizationData))]
 class LocalizationDataEditor : Editor 
 {
     LocalizationData data = null;

     void Awake()
     {
         data = target as LocalizationData;
     }
 

     public override void OnInspectorGUI ()
     {
         if (Event.current.type == EventType.Repaint)
             Debug.Log("Repaint.....");

         if (GUILayout.Button("-", new GUILayoutOption[] { GUILayout.Width(30) }))
         {
             //GUI.changed = true;
             //EditorUtility.SetDirty(target);
             Repaint();
         }
     }
 }


This should be firing a repaint event everytime I press the button but it is not firing. If I click out of the editor and then move mose over the editor I see how it is firing, so, I suppose the code should work.

I have spent part of the day trying to figure out why this is happening without any success. If anyone could help here I would really apreciate it.

Thanks in advance.

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 Loius · Apr 12, 2013 at 11:07 AM 0
Share

Is 'collapse' active in your console?

The Button probably already sends a repaint request both when it releases and when it is pressed; the Button's request and your request may be merged into a single repaint request (but I'm not sure how it all works under the hood).

Can't be much more help than that; I've used Repaint myself in $$anonymous$$ouseDown and $$anonymous$$ouseDrag events and haven't had any issue with it not triggering. :(

avatar image hexdump · Apr 12, 2013 at 11:13 AM 0
Share

Excuse for the dumb question, but what you mean by "is collapse active in your console?".

On the other hand I have been logging all events arriving to the OnInspectorGUI and when a click on the button is performed it won't do an authomatic repaint either :/.

Thanks in advance.

avatar image RAPDel · Mar 04, 2016 at 08:54 AM 0
Share

Hi everyone, I'm bumping this issue up, I'm encountering the same issue : I have a custom inspector on a Scriptable Object, and calling either SetDirty / Repaint doesn't update my inspector. Anyone has a clue ?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bezzy · Mar 07, 2018 at 09:29 PM

Anyone ever try

 EditorGUI.BeginChangeCheck();
 //Your miserable UI code here
 if(EditorGUI.BeginChangeCheck())
 {
     Repaint();
 }

it doesn't catch every case (like when i change the size of a resizeable array) but, it does catch quite a lot of changes to serialized properties.

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 Gregou-fr · Mar 13, 2018 at 12:10 PM 1
Share

I think your second BeginChangeCheck() should be EndChangeCheck()

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

Weird bug when dragging object onto EditorGUILayout.ObjectField 0 Answers

Text in custom editor is displayed/rendered with boxes around characters... 2 Answers

custom fogColor editorWindow undo problem 0 Answers

Correct behavior of the mouse wheel when zooming in a 2D area (Unity Editor) 0 Answers

How do I get a reference to the default editor windows (Hierarchy, Console, and Inspector)? 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