Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 39646
In Process

askthedev.com Latest Questions

Asked: June 8, 20252025-06-08T02:14:16+05:30 2025-06-08T02:14:16+05:30

How can I reduce touch input delay on Android 11 for my Unity mobile game?

anonymous user

I’ve been working on a mobile project in Unity and I’m running into some serious issues with touch input delay on Android 11. It’s really frustrating because I want it to be smooth and responsive, but every button press feels laggy—like there’s a 200-300ms delay.

Here’s a bit of context: I’ve set up my buttons using `rectTransforms` in the `Start()` method and I’m reading touch inputs in the `Update()` loop with the code snippet below:

“`csharp
foreach (Touch touch in Touch.activeTouches)
{
Vector2 pos = touch.screenPosition;

if (player.leftRect.Contains(pos))
input = -1f;

if (player.rightRect.Contains(pos))
input = 1f;

if (player.jumpRect.Contains(pos))
{
jumpHeld = true;
if (touch.phase == TouchPhase.Began)
jumpPressed = true;
}

if (player.dashRect.Contains(pos) && touch.phase == TouchPhase.Began)
dashPressed = true;
}
“`

The button logic seems straightforward, but when I build the game and test it on my device, it feels like I’m pressing the buttons in slow motion. I’ve also tried switching to Unity’s new Input System, thinking it might help, but that only seemed to make things worse—now the latency is around 500ms!

I’m starting to think it might be something specific to my implementation or possibly how I’m handling the input data. Other games run super smoothly on this phone, so I can’t figure out why mine is lagging.

Are there any best practices or optimizations that I might be missing? Maybe something I should change in how I handle touch inputs or something related to performance settings for mobile? Any tips or advice from your experiences would really be appreciated!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2025-06-08T02:14:18+05:30Added an answer on June 8, 2025 at 2:14 am

      The input delay you’re experiencing is likely related to how you’re processing touch inputs directly within the Update() method. Touch inputs on Android can often benefit significantly from being handled in the FixedUpdate() or utilizing Unity’s EventSystem with dedicated UI components (such as Button and EventTrigger) rather than manually checking touch positions each frame. Consider using Unity’s built-in UI system with Event triggers, or implementing the IPointer interfaces like IPointerDownHandler, which can detect user interactions reliably and immediately without delay. Additionally, ensure your rendering and physics settings are optimized—reduce draw calls, disable unnecessary graphics or post-processing effects, verify your project’s performance settings (such as target frame rate and Quality settings), and ensure the Android-specific settings are correctly configured for input responsiveness.

      If you’ve already attempted Unity’s new Input System and experienced even worse latency, you might be hitting compatibility or configuration issues there. If you’re continuing to directly poll touches, make absolutely sure you aren’t inadvertently delaying input processing by operations like heavy calculations or allocations happening within the input loop. Profile your app using Unity’s Profiler to reveal if CPU spikes or garbage collection are involved. Consider using native Android input methods or plugins designed specifically for touch responsiveness. Ultimately, tightly controlling the input cycle and leveraging either native Unity UI events or dedicated input phases (like tracking TouchPhase.Began) efficiently is your best path forward for low-latency, responsive touch handling.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2025-06-08T02:14:17+05:30Added an answer on June 8, 2025 at 2:14 am

      Touch Input Delay in Unity for Android

      Sounds like you are really facing some nasty input lag! Here are a few tips you might want to try out:

      1. Update Method Tuning

      First off, ensure that your touch input handling is efficient. You could try limiting the number of checks for touch inputs. Instead of checking for “Contains” for each touch, you could create a helper method that checks both RectTransform and their current touch positions, only looping through relevant touches. This could reduce some of the overhead.

      2. Fixed Update vs. Update

      You might want to consider using FixedUpdate() instead of Update() for handling inputs, especially if physics are involved. Even though FixedUpdate is generally for physics, sometimes it can actually help in reducing jitter, depending on how your project is structured.

      3. Input System Settings

      Since you mentioned using Unity’s new Input System, make sure you’ve properly set your touch settings in the input actions. Sometimes, tweaking the settings can reduce any latency. What about trying out different update modes? You could go with Process Events for your controls.

      4. Avoid Overdraw

      Another thing to watch for is overdraw in your UI. If your UI has many overlapping elements or is part of a complex canvas hierarchy, it could impact performance, leading to delays. Try to limit the draw calls by adjusting your UI hierarchy or batching your UI.

      5. Performance Settings

      In Unity, check some graphics settings related to quality levels. Sometimes, setting these too high can lead to performance hits on mobile devices. A good practice is to test with lower quality settings to see if that helps.

      6. Use TouchPhase Correctly

      Make sure you’re using TouchPhase.Stationary effectively as well. Sometimes capturing when a touch is still on the screen helps in making continuous actions more responsive without feeling delay on initial touches.

      Hope these tips help you get that smooth touch response you’re aiming for! It can be really tricky working with mobile input, so just keep experimenting.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Sidebar

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.