Hi Im just trying to learn a few basics,I am trying to make a varible public, but I'm not quite there. Code (csharp): function Start (){ animation.Stop(); yield WaitForSeconds(5); animation.Play(); } This is my private var version, But To make the varible public? Code (csharp): var "DelayTime":5 ; function Start (){ animation.Stop(); yield WaitForSeconds("Delaytime"); animation.Play(); } Does whatever that comes after"var" Have to come from a specific list of commands? If so what are these commands classified as and where should I look in the reference-or maybe theres some other way of making the penny drop? I just havent quite got it yet... thanks AC
Change that to: var delayTime : int = 5; The format is: var variableName : type = value; Or you can do: var variableName : type; if you don't want a default value. Normally you'd use that form for GameObjects or Transforms or that sort of thing. Or you can do: var variableName = 5; which leaves it up to Unity to determine the type. That would result in variableName being an integer. Or: var variableName = 5.0; results in variableName being a float. I almost always define the type if only to remind myself what it is...I don't think it hurts anything.... --Eric