Question by
TheSweetieApp · Sep 16, 2017 at 05:41 PM ·
animationanimatorevent
Camera animation event to play/stop another object animation.
Completely newbie... I found a lot of solutions but someone dated in Java and someone simply does not work...
I have a camera and a cube. Both with animations. At the end of the camera animation I created an event called AnimationComplete as follow:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraAnimation : MonoBehaviour {
public GameObject gameObject;
public Animation animation;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void AnimationComplete () {
Debug.Log("PrintEvent called at: " + Time.time);
gameObject = GameObject.Find("Cube");
animation = gameObject.GetComponent<Animation> ();
animation.Stop ();
}
}
I successfully see the debug message but the Cube animation does not STOP at all. I tried both with Animator and Animation.
Someone please should help?
Comment
Your answer
Follow this Question
Related Questions
Problems with using the same Animator Controller on multiple objects. 0 Answers
Animation of Splash Screen Going In Infinity 0 Answers
Mecanim state that keeps last pose? 0 Answers
Variety of animation and meshes. 0 Answers
animating in unity 0 Answers