A potential issue for both these approaches is that you can only get the controller after the animation has initialized, otherwise it will cause an error. One way to make it safer is to wrap the call in a try catch block like so: