Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

InputSystem.EnhancedTouch.Touch and Unity Ads

Discussion in 'Input System' started by VOTRUBEC, Nov 18, 2019.

  1. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    106
    I used the InputSystem.EnhancedTouch.Touch to create a simple Touch controller for simple apps. The process was incredibly easy. And for games, a Canvas with the standard UI elements is the easy way to show a Menu/Start screen etc. It's all worked very well.

    The problem I've got now is when I wanted to test Unity Ads. The default Test Unity Ad (the Placeholder) has two GUI.Button elements for the Skip and Close. What I'm seeing now is that the two GUI.Button elements aren't being piked up by the GraphicsRaycaster. I've tried to figure out how to capture touch events to pass through to the GUI.Buttons, but a couple hours on, and I've still had no luck. I then wondered what the format of Unity Ads was and how I an ensure that the InputSystem.EnhancedTouch.Touch events can be passed through correctly.

    So, in essence, there's two questions
    - How to pass InputSystem.EnhancedTouch.Touch events to IMGUI items.
    - How can I future proof InputSystem.EnhancedTouch.Touch so that they work with Unity Ads correctly, and any other Ad systems I might want to incorporate.

    Thanks good people. Hoping to hear with any sorts of suggestions.
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    I think this is something we have inadvertently broken and need to take a look at.

    For now, to receive touch input, you probably have to set "Active Input Handling" in the player settings to "Both" in order for the old input backends to run and get touch input on IMGUI elements. The problem here is that this particular functionality operates by simulating mouse input from touch input and that the code here is tied to the old input manager.

    My guess is that we can solve both this and our missing UIElement support by adding code that can synthesize UnityEngine.Events from input system data.

    I've filed a ticket and we'll have a look.

    If you do want to synthesize input from touch yourself, there's QueueGameViewInputEvent. However, until we have solved this on the input system side, it's probably easier .
     
  3. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    106
    Thanks for the information Rene-Damm. MUCH appreciated.

    Looking at your Issue entry, I tried your repro steps, and found that the moment I added "Input System (New)" either as the only system, or "Both", the IMGUI elements failed to receive notifications. It feels almost as if the new Input System is somehow capturing and consuming the Touch events, and not passing those through to the old system? Mouse input works when "Both" is selected though. So, it seems SPECIFIC to the Touch Input somehow.

    Any recollection of code that could be consuming and discarding the Touch Inputs and not allowing the old system to be aware of the input events?