Using GUI slider to control animation on object
Unity3D/Script / 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
반응형
'Unity3D > Script' 카테고리의 다른 글
마우스 휠 스크롤 확인 (0) | 2013.01.31 |
---|---|
오브젝트 카메라 프러스텀 안에 가두기 (0) | 2013.01.29 |
InGame Button (0) | 2012.12.14 |
InvokeRepeating (0) | 2012.12.07 |
DisplayWizard(에디터로 쓸모가 많을 듯 한..) (0) | 2012.12.04 |