For some reason, this gives multiple errors:
Assets\Scripts\PlayerMovement.cs(8,6): error CS1513: } expected
Assets\Scripts\PlayerMovement.cs(10,12): error CS1519: Invalid token ‘=’ in class, struct, or interface member declaration
Assets\Scripts\PlayerMovement.cs(10,39): error CS1519: Invalid token ‘(’ in class, struct, or interface member declaration
Assets\Scripts\PlayerMovement.cs(10,40): error CS8124: Tuple must contain at least two elements.
Assets\Scripts\PlayerMovement.cs(24,1): error CS1022: Type or namespace definition, or end-of-file expected
Here’s the code I took from here:
using UnityEngine;
public class PlayerController : MonoBehaviour
{
Rigidbody2D rb;
void Start()
{
public float speed;
rb = GetComponent<Rigidbody2D>()
}
void Update()
{
Move();
}
void Move()
{
float x = Input.GetAxisRaw("Horizontal");
float moveBy = x * speed;
rb.velocity = new Vector2(moveBy, rb.velocity.y);
}
}