Just trying to get a handle on coding and I’m getting a pair of errors I can’t find a solutions for.
Errors:
Assets\PlayerMovement.cs(18,24): error CS0120: An object reference is required for the non-static field, method, or property ‘Transform.right’
Assets\PlayerMovement.cs(20,20): error CS1061: ‘CharacterController’ does not contain a definition for ‘move’ and no accessible extension method ‘move’ accepting a first argument of type ‘CharacterController’ could be found (are you missing a using directive or an assembly reference?)
Code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public CharacterController controller;
public float speed = 12f;
// Update is called once per frame
void Update()
{
float x = Input.GetAxis(“Horizontal”);
float z = Input.GetAxis(“Vertical”);
Vector3 move = Transform.right * x + transform.forward * z;
controller.move(move * speed * Time.deltaTime);
}
}