Skip to content

Instantly share code, notes, and snippets.

@unity3dcollege
Created July 1, 2017 20:02
Show Gist options
  • Save unity3dcollege/ea9e01e97211983169b07b20ebc60c0f to your computer and use it in GitHub Desktop.
Save unity3dcollege/ea9e01e97211983169b07b20ebc60c0f to your computer and use it in GitHub Desktop.
var nearest = gameObjectsToConsider
.OrderBy(t=> Vector3.Distance(transform.position, t.transform.position)
.FirstOrDefault();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment