mapbox / mapbox-unity-sdk

Mapbox Unity SDK - https://www.mapbox.com/unity/
Other
723 stars 213 forks source link

Endless loop #674

Closed BlueMonk1107 closed 6 years ago

BlueMonk1107 commented 6 years ago

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++; } }

brnkhy commented 6 years ago

@BlueMonk1107 Just checked this and you're right, increment should have been out of that raycast. thanks for the report, we'll fix this asap.

abhishektrip commented 6 years ago

Addressed in v1.4.1