Title sums it up. I have been working on random generation lately. I have made it so when water is generated, there is a chance that a “water checker” is spawned. What I want the water checker to do is count the amount of water blocks in the area to see if it is suitable for fish to spawn. Now I know how to spawn fish and all, but how would I start at a script that finds blocks with the name/Tag “Water” in a certain Radius and count them? So far I have this:
var array : Array;
var NumberOfWaterBlocks = 0;
function Update(){
array = GameObject.FindGameObjectsWithTag("Water");
print(array);
NumberOfWaterBlocks = array.length;
}
So far my script counts the total amount of objects with the tag “Water” But, I only want to do it in a certain radius, around the “water checker”. How would I start this? Can someone steer me in the right direction. Thanks.