Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

(Never mind, I am an idiot)

Discussion in 'Immediate Mode GUI (IMGUI)' started by invicticide, Apr 29, 2010.

  1. invicticide

    invicticide

    Joined:
    Nov 15, 2009
    Posts:
    109
    I'm really confused. Consider the following barebones C# script:

    Code (csharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections;
    4.  
    5. public class EventEditor : Editor
    6. {
    7.     void OnSceneGUI()
    8.     {
    9.         if(Event.current)
    10.         {
    11.             // do stuff
    12.         }
    13.     }
    14. }
    That code will not compile. I get:

    Code (csharp):
    1. `Event' does not contain a definition for `current'
    I... er... what? o_O

    Event.current is explicitly referenced in the documentation, and I've done a bunch of searching of Unity resources and Google in general and it looks like everybody is using it all over the place without issues.

    I can only imagine I'm missing something hilariously obvious. :(
     
  2. invicticide

    invicticide

    Joined:
    Nov 15, 2009
    Posts:
    109
    Disregard. As I suspected, I am an idiot.

    Don't create custom classes in your project named the same as unrelated built-in classes, kids. It's bad for your sanity and it makes you look dumb on the internet. :oops:
     
  3. runningbird

    runningbird

    Joined:
    Sep 3, 2009
    Posts:
    382
    it's not that we are less it's that we are more with the knowledge learned in life.

    Always look at your endeavors as learning experiences and then you will always gain from whatever you do.
     
  4. Ethan

    Ethan

    Joined:
    Jan 2, 2008
    Posts:
    501
    S*** happens! :D