- Home /
Sound not looping properly on device?
Hi guys,
So I have this issue in my new game Get Gravel! that involves the car's engine noise. Instead of just looping properly, the engine noise makes an odd ticking sound. This doesn't happen in the Unity Editor or as a Mac build but it's happening on device... worse on some devices than others and I REALLY want to fix this.
What can I do?
Answer by POLYGAMe · Oct 03, 2013 at 05:39 AM
I should have Googled more thoroughly! Turns out it was because I was using compressed sound files. I replaced with WAV files and all working sweet.
Answer by tw1st3d · Oct 03, 2013 at 04:35 AM
You could try using an enumerator, like such:
using UnityEngine;
using System.Collections;
using System;
public class PlaySound : MonoBehavior
{
public AudioClip carSound; // Define in your editor
protected int soundLength = 0; // Define this yourself.
protected GameObject thisobj;
public void Start()
{
thisObj = gameObject;
thisobj.audio.clip = carSound;
InvokeRepeating(playSound, 0, soundLength);
}
public IEnumerator playSound()
{
thisobj.audio.Stop();
thisobj.audio.Play();
yield return null;
}
}
Ooh, nice, that might help! I actually think it's my sound file settings themselves... I just read that I shouldn't be using compressed files, so I've swapped them out for 16Bit PC$$anonymous$$ WAV files... will try that first, if it fails will test this code. Cheers :)
Your answer
Follow this Question
Related Questions
Sound pause on audio loop? 2 Answers
Gunshot Sound Playing Too Many Times 1 Answer
Horrible footstep looping problem 2 Answers
How to get first script from gameobject while having propery : Unity 0 Answers