Ok so I have an object and it has an animator component attached and a script…
now inside that script, I have a function called “shoot”.
The problem is when I tried to add an animation event, the function shoot won’t show up!(well no function shows up on the dropdown menu)
Is this a unity bug or what?
I tried creating a new project and do the same thing, but this time I can see my created functions…
Why not just do something simple like this (js):
private var GunAnimator : Animator;
var FireRate = 1.0;
function Start ()
{
GunAnimator = gameObject.GetComponent(Animator);
}
function Update ()
{
if (Input.GetMouseButtonDown(0) && counter > FireRate)
{
counter = 0.0;
GunAnimator.SetTrigger("Shoot");
gameObject.audio.Play();
//And instantiate your bullet here too...
}
counter += Time.deltaTime;
}