Created
December 29, 2018 16:23
-
-
Save am1tanaka/268c571994b974721274c0424a6563dd to your computer and use it in GitHub Desktop.
UnityのTimelineが終了したら、OnEndに登録した処理を呼び出すスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEngine.Events; | |
| namespace AM1 | |
| { | |
| /// <summary> | |
| /// TimelineにActivation Trackを追加して、アニメーションが終了した時に、検出用のオブジェクトが無効になるようにします。 | |
| /// そのオブジェクトにこのスクリプトをアタッチします。 | |
| /// オブジェクトを無効にしたのと同時にTimelineが終わるとOnDisableが呼び出されないので、 | |
| /// 終了後のアニメーションを引き延ばしておく。 | |
| /// </summary> | |
| public class TimelineEndDetector : MonoBehaviour | |
| { | |
| [Tooltip("終了時に呼び出すメソッド"), SerializeField] | |
| UnityEvent OnEnd; | |
| private void OnDisable() | |
| { | |
| OnEnd.Invoke(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment