- Home /
3d listener position only updates once
Hello, So currently I am adding in voice lines into my game and I’m running into an issue that when the voice line starts it gets the listeners original position in 3d and starts the voice line, but during the sentence, the voice line does not update while he is talking. now I’m using coroutines in unity and I’m quite new to fmod. so any help you have for me would be greatly appreciated! public Transform Robot; public Transform player; protected FMOD.Studio.EventInstance RobotVoice; public string[] voicelines; int j = 0; bool playnext = false; private void Start() { //for (int i = 0; i < voicelines.Length; i++) //{ //} playnext = true; } private void Update() { Debug.Log(j); if(j < voicelines.Length && playnext) { RobotVoice = FMODUnity.RuntimeManager.CreateInstance(voicelines[j]); RobotVoice.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(Robot.position)); StartCoroutine(LateStart(4, voicelines[j])); } } IEnumerator LateStart(float waitTime, string voicepath) { playnext = false; float Timer = 0; RobotVoice.start(); while (Timer < waitTime) { Timer += Time.deltaTime; FMODUnity.RuntimeManager.SetListenerLocation(player); yield return 0; } yield return 0; RobotVoice.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT); RobotVoice.release(); Timer = 0; j++; playnext = true; }
Your answer
Follow this Question
Related Questions
fmod 3d listener only updates once at start of script 0 Answers
Multiple Cars not working 1 Answer
Calling sound once in update 1 Answer
Distribute terrain in zones 3 Answers