• 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 Jamster · Sep 27, 2013 at 10:20 PM · editorwindow

Taskbar icon flashes when editor window open

I have a strange glitch in w$$anonymous$$ch the unity's Windows taskbar icon flashes like so whenever my ToolBar editor window is open.

alt text

I dont see any reason why is should do t$$anonymous$$s so I'd be interested to see what you guys t$$anonymous$$nk about it :P

 using UnityEngine;
 using UnityEditor;
 using System.Collections;
 using System.Collections.Generic;
 
 [InitializeOnLoad]
 public class ToolBox : EditorWindow {
     
     /* T$$anonymous$$s class provides the toolbox menu you see, allowing you to select tools to use in the
      * main program.
     */
     
     static Texture2D[] icons = null;
     
     static int selected = 0;
     static int lastSelection = 0;
     
     public static void OpenToolbox(){
         //Opens the toolbox window
         ToolBox window = (ToolBox)EditorWindow.GetWindow(typeof(ToolBox));
         window.position = new Rect(window.position.x, window.position.y, 100, window.position.height);
         
         LoadIcons();
     }
     
     static void LoadIcons(){
         //Load icons into array
         List<Texture2D> newIcons = new List<Texture2D>();
         foreach( string path in new string[] {"ArrowTool.png","LineTool.png","RectTool.png"} ){
             Texture2D icon = (Texture2D)Resources.LoadAssetAtPath("Assets/Modeler/Icons/"+path, typeof(Texture2D) );
             if( icon )
                 newIcons.Add( icon );
         }
         icons = newIcons.ToArray();    
     }
     
     void OnGUI(){
         //Calculate the number of colums there should be in the grid
         int c = (int)Mathf.Round(EditorWindow.GetWindow(typeof(ToolBox)).position.width/75);
         if( icons != null && icons.Length > 0 )
             selected = GUILayout.SelectionGrid(selected, icons, c);
         else
             LoadIcons();
         
         //Make sure we only enter line drawing mode when we have a mesh filter to edit
         if( selected != 0 && (!Selection.activeGameObject || !Selection.activeGameObject.GetComponent<MeshFilter>()) )
             selected = 0;
     }
     
     public static int GetCurrentCursor(){
         return selected;
     }
     
 }
 


untitled picture.png (6.6 kB)
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by CrazyDef · Feb 22, 2016 at 09:28 PM

I was just seeing the same behaviour when I came across t$$anonymous$$s question.

I just figured out why too:

Don't call EditorWindow.GetWindow to obtain an existing reference to your window. Keep track of it yourself and implement a way to retrieve it as you would any other singleton, or if you have multiple windows (or don't want to implement it as a singleton) pass it around (as 't$$anonymous$$s') from your EditorWindow derived class as and when you need it.

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 robertono · 6 days ago 0
Share

Worked, thanks!

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

17 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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Can someone help me fix my Javascript for Flickering Light? 6 Answers

GetWindow() creates a new instance of an already existing editorwindow 2 Answers

Material doesn't have a color property '_Color' 4 Answers

Setting Scroll View Width GUILayout 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