Sorry if this has already been covered I tried to search the forums but nothing came back, maybe I’m in the wrong sections of the forums. I suppose a mod can move this thread if I am.
I’m new to both C# coding and Unity. While going through the tutorial found in the Unity Hub “Roll - A - Ball” I was following along with the video writing the very first C# code it has you write to add movement to the player character ball. However Unity gives me back the error “Assets\Scripts\PlayerController.cs(18,5):error CS0246: The type or namespace name 'Void” could not be found (are you missing a using directive or an assembly reference?)" from what I can tell out side of colors (which again being new to both I don’t know if that is signifying any issues to me about the code because I don’t really know what they mean as of yet) my script matches the tutorial. I even downloaded the same script editor the only difference seems to again be some of their words are blue and mine are yellow (again not sure if its just a matter of different versions of the same software or I’ve typed something wrong and can’t find it)
Can anyone look over this code and tell me what I’m doing wrong because as far as I can tell its set up right, and I can’t play test the game until I figure out what’s wrong.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerController : MonoBehaviour
{
private Rigidbody rb;
private float movementX;
private float movementY;
// Start is called before the first frame update
void Start()
{
rb = GetComponet<Rigidbody>();
}
Void OnMove(InputValue movementValue)
{
Vector2 movementVector = movementValue.Get<Vector2>();
movementX = movementVector.x;
movementY = movementVector.y;
}
void FixedUpdate()
{
Vector3 movement = new Vector3(movementX, 0.0f, movementY);
rb.AddForce(movement);
}
}