Unity3D/Script
Using GUI slider to control animation on object
blueasa
2013. 1. 27. 13:32
Well, just take the example from the GUI slider reference and from Animation.Sample and you're done.
- private var hSliderValue : float = 0.0;
- private var myAnimation : AnimationState;
-
- function Start(){
- myAnimation = animation["MyClip"];
- }
-
- function LateUpdate() {
- myAnimation.time = hSliderValue;
- myAnimation.enabled = true;
-
- animation.Sample();
- myAnimation.enabled = false;
- }
-
- function OnGUI() {
- hSliderValue = GUILayout.HorizontalSlider (hSliderValue, 0.0, myAnimation.length,GUILayout.Width(100.0f));
- }
출처 : http://answers.unity3d.com/questions/59406/using-gui-slider-to-control-animation-on-object.html
반응형