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 /
  • Help Room /
avatar image
0
Question by abdielbetancourt01 · Aug 25, 2020 at 03:49 PM · consolespam

Event.Use() spamming my console,Event.Use() is spamming my console

I downloaded Brackey's UPA Toolkit and the console started spamming these 2 messages

Event.Use() should not be called for events of type Layout UnityEngine.Event:Use() UPAEditorWindow:OnGUI() (at Assets/UPAToolkit/Editor/EditorGUI/UPAEditorWindow.cs:201) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) Event.Use() should not be called for events of type repaint UnityEngine.Event:Use() UPAEditorWindow:OnGUI() (at Assets/UPAToolkit/Editor/EditorGUI/UPAEditorWindow.cs:199) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Here's the script

//----------------------------------------------------------------- // This script handles the main Pixel Art Editor. // It selects tools, finds the right pixels to color, handles input events & draws the toolbar gui. // TODO: Tidy things up. Split functionality into smaller code portions. Make even a bit of optimization? //-----------------------------------------------------------------

using UnityEngine; using UnityEditor;

public class UPAEditorWindow : EditorWindow {

 public static UPAEditorWindow window;    // The static instance of the window
 
 public static UPAImage CurrentImg;        // The img currently being edited
 
 
 // HELPFUL GETTERS AND SETTERS
 
 private float gridSpacing {
     get { return CurrentImg.gridSpacing; }
     set { CurrentImg.gridSpacing = value; }
 }
 private float gridOffsetX {
     get { return CurrentImg.gridOffsetX; }
     set { CurrentImg.gridOffsetX = value; }
 }
 private float gridOffsetY {
     get { return CurrentImg.gridOffsetY; }
     set { CurrentImg.gridOffsetY = value; }
 }
 
 private UPATool tool {
     get { return CurrentImg.tool; }
     set { CurrentImg.tool = value; }
 }
 private Color32 selectedColor {
     get { return CurrentImg.selectedColor; }
     set { CurrentImg.selectedColor = value; }
 }
 private int gridBGIndex {
     get { return CurrentImg.gridBGIndex; }
     set { CurrentImg.gridBGIndex = value; }
 }
 
 
 // MISC TEMP VARIABLES
 
 // Stores the previous tool when temporarily switching
 private static UPATool lastTool = UPATool.Empty;
 
 
 // INITIALIZATION
 
 [MenuItem ("Window/Pixel Art Editor %#p")]
 public static void Init () {
     // Get existing open window or if none, make new one
     window = (UPAEditorWindow)EditorWindow.GetWindow (typeof (UPAEditorWindow));
     #if UNITY_4_3
     window.title = "Pixel Art Editor";
     #elif UNITY_4_6
     window.title = "Pixel Art Editor";
     #else
     window.titleContent = new GUIContent ("Pixel Art Editor");
     #endif
     
     string path = EditorPrefs.GetString ("currentImgPath", "");
     
     if (path.Length != 0)
         CurrentImg = UPASession.OpenImageAtPath (path);
 }
 
 
 // Draw the Pixel Art Editor.
 // This includes both toolbar and painting area.
 // TODO: Add comments
 void OnGUI () {
     if (window == null)
         Init ();
     
     if (CurrentImg == null) { 
         
         string curImgPath = EditorPrefs.GetString ("currentImgPath", "");
         
         if (curImgPath.Length != 0) {
             CurrentImg = UPASession.OpenImageAtPath (curImgPath);
             return;
         }
         
         if ( GUI.Button (new Rect (window.position.width / 2f - 140, window.position.height /2f - 25, 130, 50), "New Image") ) {
             UPAImageCreationWindow.Init ();
         }
         if ( GUI.Button (new Rect (window.position.width / 2f + 10, window.position.height /2f - 25, 130, 50), "Open Image") ) {
             CurrentImg = UPASession.OpenImage ();
             return;
         }
         
         return;
     }
     
     // Init the textures correctly, won't cost performance if nothing to load
     CurrentImg.LoadAllTexsFromMaps();
     
     EditorGUI.DrawRect (window.position, new Color32 (30,30,30,255));
     
     
     #region Event handling
     Event e = Event.current;    //Init event handler
     
     //Capture mouse position
     Vector2 mousePos = e.mousePosition;
     
     // If key is pressed
     if (e.button == 0) {
         
         // Mouse buttons
         if (e.isMouse && mousePos.y > 40 && e.type != EventType.MouseUp) {
             if (!UPADrawer.GetLayerPanelRect (window.position).Contains (mousePos)) {
                 
                 if (tool == UPATool.Eraser)
                     CurrentImg.SetPixelByPos (Color.clear, mousePos, CurrentImg.selectedLayer);
                 else if (tool == UPATool.PaintBrush)
                     CurrentImg.SetPixelByPos (selectedColor, mousePos, CurrentImg.selectedLayer);
                 else if (tool == UPATool.BoxBrush)
                     Debug.Log ("TODO: Add Box Brush tool.");
                 else if (tool == UPATool.ColorPicker){
                     Vector2 pCoord = CurrentImg.GetPixelCoordinate (mousePos);
                     Color? newColor = CurrentImg.GetBlendedPixel( (int)pCoord.x, (int)pCoord.y );
                     if (newColor != null && newColor != Color.clear){
                         selectedColor = (Color)newColor;
                     }
                     tool = lastTool;
                 }
                 
             }
         }
         
         // Key down
         if (e.type == EventType.KeyDown) {
             if (e.keyCode == KeyCode.W) {
                 gridOffsetY += 20f;
             }
             if (e.keyCode == KeyCode.S) {
                 gridOffsetY -= 20f;
             }
             if (e.keyCode == KeyCode.A) {
                 gridOffsetX += 20f;
             }
             if (e.keyCode == KeyCode.D) {
                 gridOffsetX -= 20f;
             }
             
             if (e.keyCode == KeyCode.Alpha1) {
                 tool = UPATool.PaintBrush;
             }
             if (e.keyCode == KeyCode.Alpha2) {
                 tool = UPATool.Eraser;
             }
             if (e.keyCode == KeyCode.P) {
                 lastTool = tool;
                 tool = UPATool.ColorPicker;
             }
             
             if (e.keyCode == KeyCode.UpArrow) {
                 gridSpacing *= 1.2f;
             }
             if (e.keyCode == KeyCode.DownArrow) {
                 gridSpacing *= 0.8f;
                 gridSpacing -= 2;
             }
             
         }
         
         if (e.control) {
             if (lastTool == UPATool.Empty) {
                 lastTool = tool;
                 tool = UPATool.Eraser;
             }
         } else if (e.type == EventType.KeyUp && e.keyCode == KeyCode.LeftControl) {
             if (lastTool != UPATool.Empty) {
                 tool = lastTool;
                 lastTool = UPATool.Empty;
             }
         }
     }
     
     // TODO: Better way of doing this?
     // Why does it behave so weirdly with my mac tablet.
     if (e.type == EventType.ScrollWheel) {
         gridSpacing -= e.delta.y;
     }
     #endregion
     
     // DRAW IMAGE
     UPADrawer.DrawImage ( CurrentImg );
     
     UPADrawer.DrawToolbar (window.position, mousePos);
     
     UPADrawer.DrawLayerPanel ( window.position );
     
     e.Use();    // Release event handler
 }

}

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
0
Best Answer

Answer by abdielbetancourt01 · Aug 25, 2020 at 04:05 PM

Nevermind I just had an extra line "e.Use();". I actually solved something by myself. smol brain is growing.

Comment
Add comment · 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

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

206 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 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

Console not working 1 Answer

How do I ignore blank lines when reading a txt file? 0 Answers

Cannot Deselect Console Entry 0 Answers

1 exception was raised by workers: See the Console for details. 1 Answer

result not showing up in console 0 Answers


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