Created
July 21, 2011 09:37
-
-
Save AngryAnt/1096856 to your computer and use it in GitHub Desktop.
GUI: Circular hot zone. Very simple, but not necessarily very efficient way of determining mouse presence within a circular section of GUI space.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given: Vector2 point, float radius, inside valid GUI context | |
if (new Vector2 (Event.current.mousePosition - point).magnitude < radius) | |
{ | |
GUILayout.Label ("Inside"); | |
} | |
else | |
{ | |
GUILayout.Label ("Outside"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment