LoginSignup
0
0

More than 5 years have passed since last update.

アニメーション起動中のみ攻撃判定を表示する

Last updated at Posted at 2017-11-16
GetAnimationInfo.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GetAnimationInfo : MonoBehaviour {

    public GameObject obj;
    private AnimatorStateInfo stateInfo;
    private Animator anim;

    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void Update () {

        stateInfo = anim.GetCurrentAnimatorStateInfo (0);
        if(stateInfo.IsName("Base Layer.アニメーションの名前")){
            obj.SetActive (true);
        }else{
            obj.SetActive(false);
        }

    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0