I’ve been working on a 3-part spell sound (start, loop, end) and the transitions work properly in Studio when played individually (set the parameter in studio, play, stop, set parameter, play), but real-time changes to the parameter do not affect whether my loop continues or not. I’m unsure if this is a bug or if I’ve set my transitions up incorrectly.
I’m also encountering a related problem with my code to control this in Unity. It appears that my parameter change is not being recognized by FMOD according to a Profiler session I recorded. I have tried using both the setParameterValue and setValue commands, but neither work (and setValue is giving me a “‘FMOD.Studio.ParameterInstance’ does not contain a definition for ‘setValue’” error).
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FMODUnity;
public class PlaySound : MonoBehaviour {
[FMODUnity.EventRef]
public string ZonePath;
public FMOD.Studio.EventInstance ZoneEvent;
public FMOD.Studio.ParameterInstance ZonePI;
public float SpellPH = 0f;
void Start () {
ZoneEvent = FMODUnity.RuntimeManager.CreateInstance(ZonePath);
}
void Update () {
if (Input.GetKeyDown(KeyCode.Return))
{
ZoneEvent.start();
ZoneEvent.getParameter("SpellPhase", out ZonePI);
}
else if (Input.GetKeyDown(KeyCode.RightShift))
{
ZoneEvent.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
}
if (Input.GetKeyDown(KeyCode.KeypadPlus) && (SpellPH <3))
{
SpellPH += 1f;
ZonePI.setParameterValue(SpellPH);
}
else if (Input.GetKeyDown(KeyCode.KeypadMinus) && (SpellPH>1))
{
SpellPH -= 1f;
ZonePI.setParameterValue(SpellPH);
}
}
I just have this script attached to the same “empty object” that my ambiance emitter is attached to.