Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following code set out for a simple animation in Unity:

#pragma strict
function Start () {


function Update () {
    if (Input.GetButtonDown("KeyCode.W")){
        animation.Play("dogWalk", WrapMode.Loop);

Unfortunately, I have no idea what to do with namespaces (since they occasionally pop up as warnings but don't seem to have any purpose), and line 12 (animation.Play("dogWalk", WrapMode.Loop);) keeps generating an error regarding UnityEngine. What does it mean, and how do I fix it?


  • What do namespaces do?

  • What does the error mean and how do I get rid of it?

share|improve this question
Error is ""No appropriate version of "UnityEngine.AnimationPlay" for the argument list". – Paul Ferris Jun 12 '13 at 5:56
Could you show where the namespace code is referring to? – Sidar Jun 12 '13 at 8:15
If you ever have a problem with an error code, try searching the error message with Google. If you can't find anything, when you ask the question, you should post the exact error message text. – Byte56 Jun 12 '13 at 14:06
@Byte66 That is the exact error, I'll search it anyway though. – Paul Ferris Jun 14 '13 at 1:00
@Sidar I'm not sure. All I know is that UnityEngine is one and that the code was complaining that I didn't have any. – Paul Ferris Jun 14 '13 at 1:00
up vote 0 down vote accepted

Namespaces are like "virtual folders" where you put your classes in. Just in code. Like how Packages work in Java or AS3. Eventhough in those two languages they are explicitly structured in actual folders too. It prevents Class names to conflict with each other and it allows for vendors to be denoted.

For example:;

Like @Tetrad said, you're passing an argument to the function that is invalid.

share|improve this answer
In fact, Unity does support scripts in namespaces since version 4.0, it just isn't reflected in the documentation for some reason. – Alexander Konstantinov Jun 12 '13 at 10:26
That's weird =/ well i removed it in my answer. – Sidar Jun 12 '13 at 11:53
Thanks :). My scripting experience is limited to websites, so games give me a lot to get used to. – Paul Ferris Jun 14 '13 at 1:02

You're calling animation.Play with the wrong argument types.

The second parameter is a PlayMode, not a WrapMode.

share|improve this answer
You may use PlayMode for stopping animations, but the scripting reference says you use WrapMode to define how they run (as a loop, once, etc). But I'm not sure how well I'm using it, since it isn't working and all. – Paul Ferris Jun 12 '13 at 6:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.