What I’m trying to do is to make a script in C# that uses a function when the distance of any “People” is closer than 0.5 to the object this script is attached to. This is the (important part of) the script.
using UnityEngine;
using System.Collections;
public class PersonScript : MonoBehaviour {
public Transform[] People;
void WhenGenerate(){
Debug.Log("Generating...");
}
void Update () {
if(Vector3.Distance(People.position, transform.position) < 0.5){
WhenGenerate();
}
}
}
where you get a list of the colliders it overlaps.
Think of these functions as a cookie-cutter-shape that you place over your “world” and the inside of the form is your list of objects that matches your query.
I dont know if this function is more expensive than the other approach, but I would use it for a test, if I needed what you describe.