Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

extensible InputSystemUIInputModule

Discussion in 'Input System' started by IAndrewNovak, Oct 2, 2019.

  1. IAndrewNovak

    IAndrewNovak

    Joined:
    Nov 29, 2013
    Posts:
    104
    Hello.
    Any plans for make InputSystemUIInputModule extensible ?

    for example:


    Code (CSharp):
    1. public class MyCustomModuleTest : InputSystemUIInputModule
    2. {
    3.      public float MaxInteractionDistance = 1.2f;
    4.  
    5.      override InputSystemUIInputModule methods here
    6. }
    Now it has no errors but nothing worked and missing all ui in inspector (see screenshots).



     
  2. IAndrewNovak

    IAndrewNovak

    Joined:
    Nov 29, 2013
    Posts:
    104
  3. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Makes sense. I've added a ticket (ISX-291) for this to get looked at after 1.0. Likely all we need is exposing InputSystemUIInputModuleEditor and making it apply to subclasses, too, by default.
     
  4. IAndrewNovak

    IAndrewNovak

    Joined:
    Nov 29, 2013
    Posts:
    104
    Good news! Thanks for reply Rene ^_^
     
  5. EthanFischer

    EthanFischer

    Joined:
    Feb 10, 2016
    Posts:
    46
    Any update on this? Need to add a simple log whenever a click happens. If the private methods in InputSystemUIInputModule were 'protected' it would be trivial!
     
  6. rdjadu

    rdjadu

    Joined:
    May 9, 2022
    Posts:
    102
    Not a great solution by any means but as a workaround, should be possible to just take the UI module source from the input system package, put it in your project in a different namespace and modify it to your liking.
     
  7. EthanFischer

    EthanFischer

    Joined:
    Feb 10, 2016
    Posts:
    46
    Hmm I actually tried that, but can't get it to compile for whatever reason. I changed the name of the class and the filename, changed the namespace, tried commenting out the compiler directive at the top of the class and saw a bunch of errors. *shrugs*
     
  8. rdjadu

    rdjadu

    Joined:
    May 9, 2022
    Posts:
    102
    Ah right, think it references some internal utility stuff.

    Final resort would be to just copy com.unity.inputsystem into the project's Packages folder (so it becomes an embedded package) and then change the modifiers to protected on InputSystemUIInputModule. Updating to new versions will be slightly more annoying but with a modification as minor as that, should be pretty painless still.