- Home /
How to control animation in scene window in edit mode?
Sorry for my poor english. I can edit the process in editor but it dosen't refresh the scene window. I tried this but it didn't work in edit mode:
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof(Animation))]
[ExecuteInEditMode]
public class AnimaViewer : Editor {
protected Animation anima;
public override void OnInspectorGUI() {
base.OnInspectorGUI ();
anima = (Animation) target;
this.frame = EditorGUILayout.Slider ("process",frame,0,1);
}
protected float mFrame;
float frame{
set{
mFrame = value;
if (anima == null) {
anima = (Animation)target;
}
anima [anima.clip.name].normalizedTime = frame; // don't work while not play game
}
get{
return mFrame;
}
}
}
Comment