The Resources in not good to use at that point.
"This function can return any type of Unity object that is loaded, including game objects, prefabs, materials, meshes, textures, etc. It will also list internal stuff, therefore please be
extra careful the way you handle the returned objects. Contrary to
Object.FindObjectsOfType this function will also list disabled objects.
Please note that this function is very slow and is not recommended to be used every frame."
UnityEngine.Object can be better.
However, that's also fucked up, and slow.
C#:
List<GameObject> FindObjectsAroundFast(Vector3 givenPosition, float dist = 1f)
or
C#:
List<Entity> FindEntitysAroundFast(Vector3 givenPosition, float dist = 1f)
Example usage:
C#:
List<GameObject> ls = Util.GetUtil().FindObjectsAroundFast(victim.Location, 5f);
foreach (var x in ls)
{
if (ls.GetComponent<LootableObject>() != null)
{
// Maybe check the name of the gameobject, because a lootable object can be a chest too.
NetCull.Destroy(x);
//break; // uncomment if we need to remove only one
}
}