Input

Ensuring Feel Speak works with your input system.

Input handling is entirely up to you—you’re free to choose whichever input system best fits your needs.

How it's Handled in the Demos

The demo's use Unity's new input system. You can open the Input Actions asset to see how input was handled—it should be beside the demo scene itself. The important input key is "Interact."

3D Demo

The 3D demo has multiple input keys, most of which are for player movement.

This is the code that runs when the input button is pressed:

public void OnInteract(InputValue value)
{
    if (FeelSpeak.HasActiveDialogue)
    {
        DialogueBox.Instance?.Next();
    }
    else
    {
        FeelSpeak.InteractWithClosestSpeaker();
    }
}

What this code does is simply move on to the next dialogue text if there is active dialogue. Otherwise, it will interact with the closest speaker if the player is currently in range of one.

The Speakers are given a collider with Is Trigger enabled. This allows Feel Speak to know if the player is currently in range of a Speaker.

2D Demo

The 2D demo only has one input key because there no player movement—it's a visual novel. It uses the same interact code as well. Because the player doesn't move, the NPCs don't have range detection set up.

Talking to NPCs is handled through on-screen buttons that simply call a specific speaker's Interact method, which triggers dialogue with them.

Last updated