As you can see there is a the main problem in the title but there is more than one. These happen everytime I try to run a animation by buttons.
Errors:
Please help, I cannot seem to find any answers
My coding with said issues:
(It is a javascript)
#pragma strict
internal var animator : Animator;
var moving_yet = false;
public var Arm1_clip : AnimationClip;
public var Leg1_clip : AnimationClip;
public var Leg2_clip : AnimationClip;
function Start () {
//animator = GetComponent(Animator);
animator = GetComponent(Animator);
}
function Update () {
//Pressing keys to start animation -----------------------------------------------------------------------
//Pressing w --------------------------------------------------------
if (Input.GetKeyDown("w"))
{
if (moving_yet == false)
{
moving_yet = true;
}
}
if (Input.GetKeyUp("w"))
{
if (moving_yet == true)
{
moving_yet = false;
}
}
//--------------------------------------------------------------------
//Pressing S ---------------------------------------------------------
if (Input.GetKeyDown("s"))
{
if (moving_yet == false)
{
moving_yet = true;
}
}
if (Input.GetKeyUp("s"))
{
if (moving_yet == true)
{
moving_yet = false;
}
}
//--------------------------------------------------------------------
//Using up arrow------------------------------------------------------
if (Input.GetKeyDown(KeyCode.UpArrow))
{
if (moving_yet == false)
{
moving_yet = true;
}
}
//--------------------------------------------------------------------
//Using down arrow----------------------------------------------------
if (Input.GetKeyUp(KeyCode.DownArrow))
{
if (moving_yet == true)
{
moving_yet = false;
}
}
//--------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
//Beginning animation --------------------------------------------------------------------------------------
if (moving_yet == true)
{
animator.Play("Arm1_walking");
animator.Play("Leg1_walking");
animator.Play("Leg2_walking");
}
//----------------------------------------------------------------------------------------------------------
//Stopping animation----------------------------------------------------------------------------------------
if (moving_yet == false)
{
animator.Stop();
}
}
Okay, sadly my experience is not very good. When you open , for example: Arm1_walking. You should see a different window . I think that is where the “names” are, inside there; those are the states. Inside the ‘Player’ controller, do you have states for these animations? I see some other warnings & an error in your screen shots. Maybe look up a quick tutorial on a recent version of Unity and how it works?
Sorry I couldn’t be more help.
err, I thought that was the OP sending me a message. Those pages are what I’d look over if I was doing animation currently. (I only have 3 simple animations, and I did my best to convey my little bit of knowledge in this thread).
You never assign your animator.
Friendly suggestion: Try c# , as many more people use it , it’s easier to get (and give) advice.
Not sure about the other error.
The Animator on line 2 doesn’t seem to be assigned anywhere that I can see, is to what I was referring.
You should read over the docs the other poster in this thread suggested. Maybe just to be familiar with/see some examples. Something might stand out to you, or you might try a new way. I think in the end you’re more likely to get what you want, at least.
It was used at line 134. I figured that out when I got the error and yes I tried changing the code to make it work without it but still won’t work so I will live with the errors instead of the non-playable parts
For sure. sometimes it’s good to move forward, build more and come back to broken piece… just to keep things moving. Anyways, good luck with your project/game
I had the same problem, when i deleted the animations and created them again with same name, the problem solved now . I just written these for future viewers…