Animation only works by changing parameter (beginner question)

Hi, as the title says, beginner question.

Problem: I am trying to make the walking animation for my character.
Controls (using this guide http://unity.grogansoft.com/move-player-to-clicktouch-position/) and animations (my own made sprites) are setup and working by itself, just not when im trying to combine them.

If i manually change the parameter in animations to a greater amount then setup in the transitions (which is .01) the animation starts playing.

I have tried using google and this forum’s search engine, its just kinda hard figuring out what to look for.
Thanks in advance

Post your code :slight_smile:

Thanks for your reply!

Here you go:

using UnityEngine;
public class MoveToClickInput : MonoBehaviour
{
[SerializeField] Transform target;
float speed = 6f;
Vector2 targetPos;
private void Start()
{
    targetPos = transform.position;
}
void Update ()
{
    if(Input.GetMouseButtonDown(0))
    {
        targetPos = (Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition);
        target.position = targetPos;
    }
    if((Vector2)transform.position != targetPos)
    {
       transform.position = Vector2.MoveTowards(transform.position, targetPos, speed * Time.deltaTime);
    }
}
}

You need to manually send parameter values to your animator from your script, otherwise nothing will change.
Assuming you have a float speed parameter you would use:

1 Like

Allright thank you very much, im gonna give it my best try!

My result; With that link i came up with a fixedupdate to give float-parameter values for position and give bool-parameter values to see if the character is still walking or not. With this i can control the animation in a 4way direction.
Maybe this helps someone else facing the same problem in the future.