UnityEngine.Event.Use C# (CSharp) Method

Use() public method

Use this event.

public Use ( ) : void
return void
        public void Use()
        {
            if ((this.type == EventType.Repaint) || (this.type == EventType.Layout))
            {
                object[] args = new object[] { this.type };
                Debug.LogWarning(UnityString.Format("Event.Use() should not be called for events of type {0}", args));
            }
            this.Internal_Use();
        }

Usage Example

Ejemplo n.º 1
0
 void DrawList(Rect rect){
     UnityEngine.Event evt = UnityEngine.Event.current;
     int i = -1;
     foreach (var element in m_Data.m_ListElements) {
         i++;
         Rect label_rect = new Rect(rect.x, rect.y + k_Margin + i * k_LineHeight, rect.width, k_LineHeight);
         switch (evt.type){
             case EventType.Repaint:{
                 bool isHover = i == m_SelectedCompletionIndex;
                 menuItem.Draw(label_rect, element.m_Content, isHover, element.selected, element.selected, false);                            
             }
             break;
             case EventType.MouseDown:{
                 if (evt.button == 0) {
                     if (label_rect.Contains(evt.mousePosition)) {
                         if (m_Data.m_OnSelectCallback != null) m_Data.m_OnSelectCallback(element);
                         evt.Use();
                         editorWindow.Close();
                     }
                 }
             }
             break;
             case EventType.MouseMove:{
                 if (label_rect.Contains(evt.mousePosition)){
                     m_SelectedCompletionIndex = i;
                     evt.Use();
                 }
             }
             break;
         }
     }
 }
All Usage Examples Of UnityEngine.Event::Use