ERROR: Object reference is required nonstatic field field, method.,Object reference is required meth

Hey,
so I ran into this problem
I saw few fixes but nothing worked for me.

Does anyone know what to do with this?
Thanks.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TextInput : MonoBehaviour
{

    public InputField inputField;

    GameControlller controller;

    void Awake()
    {
        controller = GetComponent<GameControlller>();
        inputField.onEndEdit.AddListener(AcceptStringInput);
    }

    void AcceptStringInput(string userInput)
    {
        userInput = userInput.ToLower();
        controller.LogStringWithReturn(userInput);

        char[] delimiterCharacters = { ' ' };
        string[] seperateInputWords = userInput.Split(delimiterCharacters);

        for (int i = 0; i < controller.inputActions.Length; i++)
        {
            InputAction inputAction = controller.inputActions[i];
            if (inputAction.keyWord == seperateInputWords[0]) ;
            { }
        }

        {

            InputAction.RespondToInput (controller, seperateInputWords);

        }

        InputCompete();
    }

    void InputCompete()
    {
        controller.DisplayLoggedText();
        inputField.ActivateInputField();
        inputField.text = null;
    }
}

Please, post the entire error message otherwise we can only guess what could be the problem.

You should always post the error message since it gives line numbers, but a quick glance I assume this is your error.

InputAction.RespondToInput (controller, seperateInputWords);

You have a capital “I” so it’s pointing to the class and not the instance that you you maybe meant to create. However, you also have a lot of extra curly brackets and the instance you did create above it is within a for loop, which means the line I reference would not access the instance.

I suspected this as well.

So sorry about that!

The full error is:
An object reference is required for non-static field, method, or propety ‘InputAction.RespondToInput(GameController,string[ ])’

So sorry about that!

The full error is:
An object reference is required for non-static field, method, or propety ‘InputAction.RespondToInput(GameController,string[ ])’

Hello,
I lowered the I in inputAction but now it just says:
The name ‘inputAction’ does not exist in the current context

You need to learn more about scripting.

You need to declare and define inputAction to fix the problem.

You need to learn about the scope of variables. inputAction doesn’t work there because where you declared it is in a for loop. As I said, you can’t access it. When you declare a variable in a for loop, it belongs to that for loop and can’t be accessed outside of it.

Yeah I fixed it somehow…