I can't make my character move
So i'm trying to make a 2d character move around on the screen. I tried more than one tutorial on how to make the code but nothing worked yet.(you can tell i'm new to this) This is the last code i tried:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed;
public Rigidbody2D rb;
Vector2 movement;
void Update()
{
MovementInput();
}
private void FixedUpdate()
{
rb.velocity = movement;
}
void MovementInput()
{
float mx = Input.GetAxisRaw("horizontal");
float my = Input.GetAxisRaw("vertical");
movement = new Vector2(mx, my).normalized;
}
}
It seemed to work for the guy on the video but not for me. The "Move Speed" inside the unity editor is set to 5. it's probably not related to this but i think i should say that i also messed around with the Active Input Handling, and downloaded the new input in my attempts to make this work, but nothing. At this point i'm don't know if it's the code or if i just messed something up in some configuration.
If anyone could just tell me how i can make this work it would be apreciated.
Your answer
Follow this Question
Related Questions
2D movement along vector 1 Answer
(Help) I am having trouble with creating a simple 2D game in Unity. Please help. :) 0 Answers
Why won't my 2D Sprite Move? 1 Answer
How to move a game object to a position after selecting it 0 Answers
Implementing a "flyer" game in with the old CardBoard Google sdk 2 Answers