Answer the question
In order to leave comments, you need to log in
Character movement script not working. What to do?
I want to make a 2d game with a top view. I wrote a script, but for some reason it does not work. Unity does not write an error, the script just does not work and that's it. Unity version 2018.2.2.1 and 2019.1.12f1 (tried on both)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMove : MonoBehaviour
{
[SerializeField]
public float speed;
private Rigidbody2D rb;
[SerializeField]
private Vector2 moveInput;
private void Awake()
{
rb = GetComponent<Rigidbody2D>();
}
private void Update()
{
moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
moveInput = moveInput.normalized * speed;
}
private void FixiedUpdate()
{
rb.velocity = moveInput;
}
}
Answer the question
In order to leave comments, you need to log in
You have already been advised to start using the debugger. But you probably have a banal typo in the name of the FixedUpdate() method. You have written FixiedUpdate().
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question