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

How to use the new InputSystem with DOTS/ECS?

Discussion in 'Input System' started by RogueStargun, May 30, 2020.

  1. RogueStargun

    RogueStargun

    Joined:
    Aug 5, 2018
    Posts:
    286
    I know DOTS is still experimental, but are there any examples out there on how to use the new inputsystem with DOTS/ECS?
     
  2. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    939
    Hi,

    Here is how I do it for now :
    1. create a monobehavior implementing IConvertGameObjectToEntity
    2. create an "input forwarder" monobehavior
    3. grab a reference to the player entity during the convertion process (1.) and set it to the input forwarder (2.)
    4. in the input forwarder create a method taht read the user input and set a player input IComponentData on the player entity (3.)
    5. set it up in scene with a convert and inject for the gameobject that has the 2 monobehavior described above.
     
  3. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    825
    Mithraell likes this.
  4. awokeknowing

    awokeknowing

    Joined:
    Sep 12, 2018
    Posts:
    2
    seems to not work on linux ubuntu 20