Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to stop animation

Discussion in 'Animation' started by sonys222, Aug 19, 2015.

  1. sonys222

    sonys222

    Joined:
    Jun 3, 2015
    Posts:
    32
    Hey. I have a problem, because when game is restarted, animation start again..

    using UnityEngine;
    using System.Collections;

    public class GameOverManager : MonoBehaviour
    {

    public ColiderDestroyObject hasEnded;
    Animator anim;

    void Awake ()
    {
    anim = GetComponent <Animator> ();

    }


    void Update ()
    {

    if (ColiderDestroyObject.hasEnded==true) {
    anim.SetTrigger("GameOver");
    }
    }
    }
     
  2. sonys222

    sonys222

    Joined:
    Jun 3, 2015
    Posts:
    32
    Problem is resolved