Hi.
You can have a array where you can add objects you want to check the distance from.
Then loop the array to get the distances.
or you can have a fsm on the spawned objects to get the distance.
But if you have lots of objects you might not want to do this every frame.
Yeah, I think the clean way is using the array proxy.
Heavygunner had the right idea. Because from I can tell, storing multiple prefabs on a global variable would definitely require some sort of array/ array proxy.
Think about this scenario. If I had a crate of different objects that were deliberately untagged, and the crate emptied all the contents on the ground, the system I have right now would only capture the distance of the last object. By adding an array it should keep the process more consistent.