Skip to main content
added 92 characters in body
Source Link

I have created the walking and idle animation for my fps player. I've added a JavaScript script to access it, but when I run it and press button(w), it stops and says that the animation is not attached to the object.

When I drag the walking/idle animation and drop to that object, it creates an animation controller. Again I run it, still same error. I can't find where to attach the animation

Here's my script:

function Update () 
{
  if(Input.GetKeyDown("w"))
  {
    GetComponent.<Animation>().Play("walk_anim2", PlayMode.StopAll);
  }
  if(Input.GetKeyUp("w"))
  {
    GetComponent.<Animation>().Play("idle_anim2", PlayMode.StopAll);
  }
}

Where do I need to attach the animation?

enter image description here

I have created the walking and idle animation for my fps player. I've added a JavaScript script to access it, but when I run it and press button(w), it stops and says that the animation is not attached to the object.

When I drag the walking/idle animation and drop to that object, it creates an animation controller. Again I run it, still same error. I can't find where to attach the animation

Here's my script:

function Update () 
{
  if(Input.GetKeyDown("w"))
  {
    GetComponent.<Animation>().Play("walk_anim2", PlayMode.StopAll);
  }
  if(Input.GetKeyUp("w"))
  {
    GetComponent.<Animation>().Play("idle_anim2", PlayMode.StopAll);
  }
}

Where do I need to attach the animation?

I have created the walking and idle animation for my fps player. I've added a JavaScript script to access it, but when I run it and press button(w), it stops and says that the animation is not attached to the object.

When I drag the walking/idle animation and drop to that object, it creates an animation controller. Again I run it, still same error. I can't find where to attach the animation

Here's my script:

function Update () 
{
  if(Input.GetKeyDown("w"))
  {
    GetComponent.<Animation>().Play("walk_anim2", PlayMode.StopAll);
  }
  if(Input.GetKeyUp("w"))
  {
    GetComponent.<Animation>().Play("idle_anim2", PlayMode.StopAll);
  }
}

Where do I need to attach the animation?

enter image description here

edited tags
Link
Kromster
  • 10.7k
  • 4
  • 54
  • 67
Fixed formatting and tags.
Source Link
Vaillancourt
  • 16.4k
  • 17
  • 55
  • 61

iI have created the walking &and idle animation for my fps player. i'veI've added a java_scriptJavaScript script to access it. but, but when iI run it &and press button(w), it stops &and says that,that the animation is not attached to the object.. when i

When I drag the walking/idle animation &and drop toto that object, it creates an animation controller. again iAgain I run it, still same error. iI can't find where to attach the animation ?????? Here's

Here's my java script:

function Update () 
{

        if(Input.GetKeyDown("w"))
        {
            GetComponent.<Animation>().Play("walk_anim2", PlayMode.StopAll);
        }
        if(Input.GetKeyUp("w"))
        {
            GetComponent.<Animation>().Play("idle_anim2", PlayMode.StopAll);
        }

        

}
function Update () 
{
  if(Input.GetKeyDown("w"))
  {
    GetComponent.<Animation>().Play("walk_anim2", PlayMode.StopAll);
  }
  if(Input.GetKeyUp("w"))
  {
    GetComponent.<Animation>().Play("idle_anim2", PlayMode.StopAll);
  }
}

 

Where do I need to attach the animation?

i have created the walking & idle animation for my fps player. i've added a java_script to access it. but, when i run it & press button(w), it stops & says that, the animation is not attached to the object.. when i drag the walking/idle animation & drop to that object, it creates an animation controller. again i run it, still same error. i can't find where to attach the animation ?????? Here's my java script:

function Update () 
{

        if(Input.GetKeyDown("w"))
        {
            GetComponent.<Animation>().Play("walk_anim2", PlayMode.StopAll);
        }
        if(Input.GetKeyUp("w"))
        {
            GetComponent.<Animation>().Play("idle_anim2", PlayMode.StopAll);
        }

        

}

 

I have created the walking and idle animation for my fps player. I've added a JavaScript script to access it, but when I run it and press button(w), it stops and says that the animation is not attached to the object.

When I drag the walking/idle animation and drop to that object, it creates an animation controller. Again I run it, still same error. I can't find where to attach the animation

Here's my script:

function Update () 
{
  if(Input.GetKeyDown("w"))
  {
    GetComponent.<Animation>().Play("walk_anim2", PlayMode.StopAll);
  }
  if(Input.GetKeyUp("w"))
  {
    GetComponent.<Animation>().Play("idle_anim2", PlayMode.StopAll);
  }
}

Where do I need to attach the animation?

Source Link
Loading