Created
September 28, 2017 08:48
-
-
Save donovankeith/6544405b5e6f590564caac729a4f78fd to your computer and use it in GitHub Desktop.
A Unity Script for Scrubbing Animations
This file contains 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 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