I have Fmod Studio integrated with Unity and I’m now trying to play an Fmod Studio Event on an animation’s keyframe.
On the Animation’s timeline I set a keyframe to enable the following script:
using UnityEngine;
using System.Collections;
using FMOD.Studio;
public class AnimationPlayFmodSound : MonoBehaviour {
void OnEnable () {
FMOD_StudioSystem.instance.PlayOneShot ("event:/Resources/FX/fx_column_effect", transform.position);
}
}
I thought it should play only when the script is enabled, but apparently the event plays as soon as I start the game (before the animation occurs). What am I doing wrong here?