Fixed out of audio range error

This commit is contained in:
Daniel Tyomin 2024-08-19 22:47:13 +02:00
parent 10604a0fa9
commit 725c10e541
1 changed files with 2 additions and 1 deletions

View File

@ -19,7 +19,8 @@ public class ConveyorBelt : MonoBehaviour
private void Start() private void Start()
{ {
audioSource.time += Random.Range(1f, 3f); float length = audioSource.clip.length;
audioSource.time += Random.Range(0.2f * length, 0.4f * length);
audioSource.pitch = Random.Range(-0.05f, 0.05f) + speed / 2f; audioSource.pitch = Random.Range(-0.05f, 0.05f) + speed / 2f;
startPosition = rb.position; startPosition = rb.position;