I know that sounds like a joke, like if it’s not working just turn it off and on again but that’s where I’m at.
My character controller will not work unless I disable it in the inspector and then enable it again. I don’t know how I achieved this bug because it used to work fine.
I don’t know if anyone can help me with this because it seems so strange, but I’m really not sure where to start so if anyone knows anything about this type of issue I’d appreciate any insight whatsoever.
-Thanks in advance
Hi thanks for the response @ShadoX !
Sorry about that, It’s a script i typed out after watching some tutorials and it goes a little something like this.
I added an on start disable and then enable character controller so it’s working again but it bothers me that I did that, feels very sloppy to just patch it instead of fixing the problem you know?
public class CharacterController : MonoBehaviour
{
public float moveSpeed = 5f;
public Rigidbody2D body;
Vector2 movement;
public Animator animator;
void Update()
{
//This handles which animation should play for character
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
animator.SetFloat("Horizontal", movement.x);
animator.SetFloat("Vertical", movement.y);
animator.SetFloat("Speed", movement.sqrMagnitude);
}
private void FixedUpdate()
{
//this handles the actual physical movement of player
body.MovePosition(body.position+movement * moveSpeed * Time.fixedDeltaTime);
}
}