Skip to content

Instantly share code, notes, and snippets.

@donovankeith
Created September 28, 2017 08:48
Show Gist options
  • Save donovankeith/6544405b5e6f590564caac729a4f78fd to your computer and use it in GitHub Desktop.
Save donovankeith/6544405b5e6f590564caac729a4f78fd to your computer and use it in GitHub Desktop.
A Unity Script for Scrubbing Animations
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScrubAnimation : MonoBehaviour {
private Animator anim;
public string animClipName;
float normalizedTime = 0f;
// Use this for initialization
void Start () {
anim = GetComponent<Animator> ();
anim.speed = 0;
}
// Update is called once per frame
void Update () {
Debug.Log (normalizedTime);
anim.Play(animClipName, -1, normalizedTime);
}
public void UpdateTime(float updatedTime){
normalizedTime = updatedTime;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment