- Home /
Unity doesn't recognise new Input system error CS0234
Hi. absolute newbie to unity and I have been having some real problems with using the new input system.
I am trying to learn how to create games on unity and so am following a Udemy video coding learning program. I first created a 2D game and when I installed the new unity imput system I would get bizarre error code that said "error CS0103: The name 'keyboard' does not exist in the current context." That was using unity version 2020.3.17f1 because of the following code:
using System.Collections; using System.Collections.Generic; using UnityEngine;
using UnityEngine.InputSystem;
public class GatherInput : MonoBehaviour { public int directionX = 0;
void Update()
{
if (Keyboard.current.dkey.isPressed)
directionX = 1;
else if (Keyboard.current.akey.isPressed)
directionX = -1;
else
directionX = 0;
}
}
When i used a capitilisation of the letter "K" the message changed to: error CS1061: 'Keyboard' does not contain a definition for 'dkey' and no accessible extension method 'dkey' accepting a first argument of type 'Keyboard' could be found (are you missing a using directive or an assembly reference?)
So I changed to a new version just today. now version 2020.3.18f1; and after entering the above same code my error message read:
Assets/Scripts/GatherInput.cs(5,19): error CS0234: The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Renderer on object disabled after level reload 1 Answer
Full screen camera missing? 3 Answers
Error Changing Rigidbody Velocity 1 Answer