I had a working Player control script which used mouse to navigate the player. After I created the various animation states, the script doesn’t work anymore. Here is the link to how the animation states are - 1 . Toggling the Animator component on the Player off makes the movement work properly again. The following is my code for the Player
using UnityEngine;
using System.Collections;
public class MoveCtrl : MonoBehaviour {
private Vector3 mousePosition;
public float moveSpeed = 0.1f;
void Start () {
Screen.showCursor = false;
}
void Update () {
if (Input.GetMouseButton(0)) {
mousePosition = Input.mousePosition;
mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
transform.position = Vector2.Lerp(transform.position, mousePosition, moveSpeed);
}
}
}