- Home /
"if AnimatorController A, play this sound, if AnimatorControllerB, play this one" ? Is there a way to do this?
I have a character that has an equal chance of being spawned into the game as a male or female version by changing the runtime animator controller. The problem is I cant seem to figure out how to make it only play the sounds for the male or female version. I can randomize the audio clip, but then the chances of having a male character with a female voice is 50%, heh.
Answer by RocketFriday · Sep 15, 2018 at 03:49 AM
if(anim.runtimeAnimatorController.name == "femalecontrollerName")
{
play female sound
}else
if(anim.runtimeAnimatorController.name == "malecontrollerName")
{
play male sound
}
No problem, you should read up on your coding whenever you have spare time, it'll be very helpful if you plan on making games.
Your answer
Follow this Question
Related Questions
How to switch Animator controllers in script? 1 Answer
How to change animation clips of an animator state at runtime? Is there a way? 5 Answers
Rotating the upper body of a game character 1 Answer
Why does my transition freeze the second animation on it's first frame? 1 Answer
Changing ANIMATION warp mode not working properly (!) 0 Answers