@gowtham_innvoreality
Hi
I want to animate my Game objects that may be child or parent where by using button animation are controlled just like we use to watch video in player same function like Play, Pause, Reverse & Forward like that.
I was able to animate my Game object til Play, Pause & Forward animation on Game objects. But not possible on Reverse of animation.
My code below:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class cubeanima : MonoBehaviour
{
// Cube Parent as Game object
public GameObject Cubeanim; // Cube Parent
public Canvas myCanvas; // Canvas with Button as game object
// Use this for initialization
public void Start ()
{
Debug.Log ("Game Object Activated");
Cubeanim.SetActive (true); // Cube parent is activated
myCanvas.gameObject.SetActive(true); // Canavas is active
}
// Pause & Resume Gameobject during Game play
public void Pause_Anim()
{
Debug.Log ("Pressed Pause");
if (Time.timeScale == 0.25F)
{
Time.timeScale = 0F;
}
else
{
Cubeanim.SetActive (true);
myCanvas.gameObject.SetActive (true);
Cubeanim.GetComponent<Animator> ().enabled = true;
Time.timeScale = 0.25F;
}
}
// Repositoning Cube to original position
public void Rewind()
{
Debug.Log ("Pressed Repos");
//Unhiding all button which are game objects
Cubeanim.SetActive (false);
}
// Fastforward Cube movement
public void Forward()
{
Debug.Log ("Pressed Forward");
Cubeanim.GetComponent<Animator> ().enabled = true;
if (Time.timeScale == 0.25F)
{
Time.timeScale = 1.5F;
}
else
{
Time.timeScale = 0.25F;
}
}
}
In the above Rewind(). i have made the Game object to false instead i want game object to be true & display reverse play of Animation.
i have Animation clip of “Cmove” for my Gameobject.
Please help me on reverse. Any suggestion or advice on code are welcome.
Please tell any solution only on C#. I don’t know Javascript in Unity.
Thank you.