If _layerMask is set incorrectly in SpawnInsideModifier, it will cause the while loop in the Run function.
while (_spawnedCount < spawnCount)
{
var x = UnityEngine.Random.Range(-bounds.extents.x, bounds.extents.x);
var z = UnityEngine.Random.Range(-bounds.extents.z, bounds.extents.z);
var ray = new Ray(bounds.center + new Vector3(x, 100, z), Vector3.down 2000);
RaycastHit hit;
//Debug.DrawRay(ray.origin, ray.direction 1000, Color.yellow, 1000);
if (Physics.Raycast(ray, out hit, 1000, _layerMask))
{
......
// When the layer is not found, it will not be executed here
_spawnedCount++;
}
}
If _layerMask is set incorrectly in SpawnInsideModifier, it will cause the while loop in the Run function.