Skip to content

Instantly share code, notes, and snippets.

@AngryAnt
Created July 21, 2011 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AngryAnt/1096856 to your computer and use it in GitHub Desktop.
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.
// 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