Hi.
I set up this to trigger the Player_Fire animation when I click.
the script:
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Animator))]
public class PlayerFire : MonoBehaviour {
#region variables
private PlayerStats player_stats;
private Animator player_anim;
#endregion
#region methods
void Start () {
player_anim = GetComponent<Animator>();
player_stats = GetComponent<PlayerStats>();
if (!player_stats)
Debug.LogError("Player Stats Script not assigned!!!");
}
void Update () {
if (player_stats) {
if (Input.GetMouseButtonDown(0)) {
// roda a animação do tiro
if (player_anim) {
player_anim.SetTrigger("Firing");
}
GameObject bullet = Instantiate(
player_stats.Fire_Weapon_Bullet_Prefab,
player_stats.Fire_Weapon_Slot.position,
player_stats.Fire_Weapon_Slot.rotation) as GameObject;
Bullet_Laser bl = bullet.GetComponent<Bullet_Laser>();
bl.Owner = gameObject;
}
}
}
#endregion
}
The problem:
I really want to this animation run at the moment I trigger it! but it’s delaying or waitting the Blend tree, no matter what transition scale/time I set.
May someone help me figure this out?