How to use New Input System in Unity ECS?

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ม.ค. 2025

ความคิดเห็น • 5

  • @ahappyharry5177
    @ahappyharry5177 12 วันที่ผ่านมา +1

    I wanted to ask, why did you set up InputSystem and PlayerInputSystem separately. you can do the task in one class right? just want to know why choose that architecture ♥

    • @TaleForgeStudio
      @TaleForgeStudio  11 วันที่ผ่านมา +1

      In our scenario - yes, you can! However, if you want to add a mini-game like Memory, or handle some custom UI popups, or anything else to your game, you can split the responsibility to the MemoryGameInputSystem and SomeCustomInputSystem. For me, PlayerInputSystem is strictly related to the "Game" section, so - if it is more readable for you - you can call it GameInputSystem ❤️

  • @ahappyharry5177
    @ahappyharry5177 5 หลายเดือนก่อน

    In my debug.log i get double logs for each button press. like if i press A i get -1 two times, and when i press D i get 1 two times. what could be causing this?

    • @TaleForgeStudio
      @TaleForgeStudio  5 หลายเดือนก่อน

      Make sure you only add the subscription to the Input event once 😊

    • @TaleForgeStudio
      @TaleForgeStudio  5 หลายเดือนก่อน +2

      Harry's case (after talking on Discord)
      - He was using Unity Netcode for ECS, so there were two worlds: client and server - so he had duplicated Debug.Logs
      Solution:
      - Use [WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)] attribute for InputSystem class, so only client instance gets Debug.Log()