Log in or register to post comments

Unity GUI button to control 3d model animation....

January 3, 2012 - 1:55am #1

I have created an Image target to show my 3d character which has 2 animation on it. Can I use UnityGUI to create 2 button to trigger 2 different animations? For example, when touch the Button1 on the screen, my character jumps, and when touch Button2, my character runs.

Is the coding like this?
function OnGUI () {
if (GUI.Button (Rect (10,10,150,100), "Run")) {
animation["Run"].wrapMode = WrapMode.Loop;
animation.Play("Run");
}
}

Re: Unity GUI button to control 3d model animation....

January 3, 2012 - 2:27pm #2

http://unity3d.com/support/documentation/Manual/Character-Animation.html
http://unity3d.com/support/documentation/ScriptReference/Animation.html

- Kim

Log in or register to post comments