question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InputComponent.BindAction() InputEvent.Repeat delayed

See original GitHub issue

The following results in the debug message being displayed as soon as the key is pressed:

public static class ObjectOrientedDesign
{
    private static Player _player;
    public static void OnBeginPlay()
    {
        Debug.AddOnScreenMessage(-1, 3.0f, Color.LightGreen, MethodBase.GetCurrentMethod().DeclaringType + " system started!");

        Engine.AddActionMapping("TestInput", Keys.W);
        _player = new Player(nameof(Player));
    }

    public static void OnEndPlay() => Debug.ClearOnScreenMessages();
}

public class Player : Actor
{
    public Player(string name = null) : base(name)
    {
        Debug.AddOnScreenMessage(-1, 3.0f, Color.Orange, name);
        SetEnableInput(World.GetFirstPlayerController(), true);
        InputComponent.BindAction("TestInput", InputEvent.Pressed, TestInput);
    }

    public static void TestInput() => Debug.AddOnScreenMessage(-1, 0.1f, Color.Aqua, $"Input {World.RealTime}");
}

Changing InputEvent type to Repeat results in a noticeable delay of around 1-1.5 secs

public Player(string name = null) : base(name)
{
    Debug.AddOnScreenMessage(-1, 3.0f, Color.Orange, name);
    SetEnableInput(World.GetFirstPlayerController(), true);
    InputComponent.BindAction("TestInput", InputEvent.Repeat, TestInput);
}

Should the input system be taking this long to trigger the event?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
ScottKanecommented, Aug 15, 2020

I have submitted a bug report with proposed improvements. To me it would make a lot of sense as it would allow a character to be controlled by input events without ticking while preserving compatibility

1reaction
ScottKanecommented, Aug 14, 2020

Also just looking through some of the Framework methods, would be nice if for anything that just takes a ref to return to as a void we could have a corresponding non void convenience method like so:

/// <summary>
/// Retrieves the current size of the viewport and returns to a reference
/// </summary>
public static void GetViewportSize(ref Vector2 value) => getViewportSize(ref value);

/// <summary>
/// Retrieves the current size of the viewport
/// </summary>
public static Vector2 GetViewportSize()
{
    Vector2 value = default;
    getViewportSize(ref value);
    return value;
}

/// <summary>
/// Retrieves the current resolution of the screen and returns to a reference
/// </summary>
public static void GetScreenResolution(ref Vector2 value) => getScreenResolution(ref value);

/// <summary>
/// Retrieves the current resolution of the screen
/// </summary>
public static Vector2 GetScreenResolution()
{
    Vector2 value = default;
    getScreenResolution(ref value);
    return value;
}

/// <summary>
/// Retrieves the current location of the <a href="https://docs.unrealengine.com/en-US/Engine/LevelStreaming/WorldBrowser/index.html">world origin</a> to a reference
/// </summary>
public static void GetWorldOrigin(ref Vector3 value) => getWorldOrigin(ref value);

/// <summary>
/// Retrieves the current location of the <a href="https://docs.unrealengine.com/en-US/Engine/LevelStreaming/WorldBrowser/index.html">world origin</a>
/// </summary>
public static Vector3 GetWorldOrigin()
{
    Vector3 value = default;
    getWorldOrigin(ref value);
    return value;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use "IE_Repeat" EInputEvent for Mouse Buttons
I have the following: InputComponent->BindAction(“Drag”, IE_Pressed, this, &AAbatronPlayerController::OnDragStarted); InputComponent->BindAction ...
Read more >
Setting Up Inputs
In the Components tab, click Add(+), then from the drop down search for and select Spring Arm. · Repeat step 1, but search...
Read more >
WTF Is? Input: Is Repeat in Unreal Engine 4 ( UE4 ) - YouTube
What is the Input: Is Repeat Node in Unreal Engine 4 Source Files: ... UE4 Tutorial - For Each Loop With Delay. Aurora...
Read more >
Binding Input in C++ with Unreal Engine 4 - Unrealistic
Bind to an Action Input using the BindAction() function on UInputComponent . It takes an input identifier name, an event type, ...
Read more >
Unreal input action. I have been at it for a few days referri
I'm trying to read input in a blueprint, but input events don't fire. ... Bind to an Action Input using the BindAction() function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found