Advertisement
Munchy2007

Handle Selection

Apr 18th, 2019
989
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1.         // Get the needed data before the handle
  2.         int controlIDBeforeHandle = GUIUtility.GetControlID(someHashCode, FocusType.Passive);
  3.         bool isEventUsedBeforeHandle = (Event.current.type == EventType.Used);
  4.  
  5.         // Draw the handle at the position of each node in the waypoint array
  6.  
  7.  
  8.         // Get the needed data after the handle
  9.         int controlIDAfterHandle = GUIUtility.GetControlID(someHashCode, FocusType.Passive);
  10.         bool isEventUsedByHandle = !isEventUsedBeforeHandle && (Event.current.type == EventType.Used);
  11.  
  12.         if
  13.          ((controlIDBeforeHandle < GUIUtility.hotControl &&
  14.            GUIUtility.hotControl < controlIDAfterHandle) ||
  15.            isEventUsedByHandle)
  16.         {
  17.             selectedNodeIndex = n; // This gives me the index of the node that is selected
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement