I'm trying to make a C# script for unity to create dialogue using 'Ink.Runtime' and this section of the code is attempting to switch to a new line of text when a button is pressed, but it won't work, it's giving me the constant error message:
Assets\C# Scripts\DialogueManager.cs(37,13): error CS0103: The name 'InputManager' does not exist in the current context
the code is written below:
private void Update()
{
if (!dialogueIsPlaying)
{
return;
}
if (InputManager.GetInstance(). GetSubmitPressed())
{
ContinueStory();
}
}
I think there's an issue that that I haven't defined the InputManager, or maybe it's that I'm still using the old input system and this could be written using the new one. If it's either of these how would I go about defining the InputManager/converting it to the older Input system. I'm relatively new to coding in C# and so can't find a fix to this issue, help would be much appriciated!
CodePudding user response:
You guessed right if you didn't declare InputManager anywhere in your code. In order to use new input system you need to define input actions (which Brackeys described pretty well here https://www.youtube.com/watch?v=Pzd8NhcRzVo).
If you need simlpe solution you can use old input system and check whether specific key was pressed like this if (Input.GetKeyDown("space"))
- Unity documentation, but I really recommend checking out new input system cos it's gonna be better in the long run