Domain changed to archive.palanq.win . Feb 14-25 still awaits import.
[2 / 1 / 1]

Unity 2D Game Coding

No.1548930 View ViewReplyOriginalReport
I'm trying to figure out why my character isn't moving. I've followed multiple tutorials online with no success. My character never moves.

Can I get some help with what is going on?

When I put in rb.velocity = new Vector2(horizontal, vertical); it strikes a line through velocity, or force updates to "angularVelocity" and nothing moves. Using Unity 6.2. What's going on?

Error CS0029: Cannot implicitly convert type 'UnityEngine.Vector2' to 'float'

using System.Collections;
using System.Collections.Generic;
using JetBrains.Annotations;
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerMovement : MonoBehaviour
{
public float speed = 5;
public Rigidbody2D rb;

void Update()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");

rb.velocity = new Vector2(horizontal, vertical);
}
}