Problem Play Animation from once

Hi! I have a problem with Play Animation from once. Animation can be play but it loop… I wanna to once.

var CRed = "r";
var CGreen = "g";
var string = "";
 
function OnGUI () {
    GUI.Label(Rect (10, 10, 60, 20), "Lang: ");
	
    string = GUI.TextField (Rect (75, 10, 200, 20), string, 200);
 
    if(string == CRed){
			animation["Red"].wrapMode = WrapMode.Default;
			animation.Play("Red");
			}
			else
			{
	if(string == CGreen){
			animation["Green"].wrapMode = WrapMode.Default;
			animation.Play("Green");
			}
    }
}

Sorry my bad speak english

Try

animation[“Red”].wrapMode = WrapMode.Once; // instead of Default

and

animation[“Green”].wrapMode = WrapMode.Once; // instead of Default

Same for Green.

I understand, You have ration and no must you help me, just i know. I try add button… Press button give to once animation… thanks :wink: