I am getting 2 errors in my c# script.
Assets\scripts\playerMovement.cs(8,5): error CS0118: 'PlayerControls' is a namespace but is used like a type
Assets\scripts\playerMovement.cs(4,19): error CS0234: The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
playerMovement.cs:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; public class playerMovement : MonoBehaviour { PlayerControls controls; Vector2 move; void Awake() { controls = new PlayerControls(); controls.Gameplay.move.performed += ctx => move = ctx.ReadValue<Vector2>(); controls.Gameplay.move.canceled += ctx => move = Vector2.zero; } void Update() { Vector2 m = new Vector2(move.x, move.y) * Time.deltaTime; transform.Translate(m, Space.World); } }
I am using the new Input System 0.2.1 in unity 2018.4.25f.
The PlayerControls script is auto-generated from an Actions Input object, and it is in the main root "Assets".