Hi,
I’m calling sound effects on animations by adding an event on the animation timeline and inserting the corresponding function name used in my animation script.
I was wondering if it’s possible to automate this process a little bit, so I don’t need to go into the animation script and edit all function names for the different animations, but rather just set the function name from the inspector using a string. I was thinking about something like this:
public class FMODAnimation : MonoBehaviour
{
public string AnimationName;
public FMODUnity.EventReference FireballEvent;
void AnimationName()
{
FMODUnity.RuntimeManager.PlayOneShot(FireballEvent, transform.position);
}
}
Don’t mind the FMOD code, it’s really just about the function name. Obviously it is not working, but is there a way to set the function name somehow from outside the script?