How I Use Unity's New Input System

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ย. 2024

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

  • @EvaSienna
    @EvaSienna ปีที่แล้ว +1

    Many thanks! There are so many tutorials that explain how to use the system without explaining why you're coding what you're coding, what the purpose of anything even is..
    Found this really helpful as a total unity noob, appreciate the explanations greatly 🥰

    • @xepherin_dev
      @xepherin_dev  ปีที่แล้ว +1

      Great to hear! I wish you luck on your Unity journey

  • @sKryly1
    @sKryly1 ปีที่แล้ว +1

    I just did the same thing you did, just an unnecessarily complicated version of it. I feel dumb and happy at the same time. Glad I found your video!

  • @newleafgames
    @newleafgames ปีที่แล้ว +1

    You really have just helped me out. Very well explained.

  • @HehJimbow187
    @HehJimbow187 ปีที่แล้ว

    Thank you so much for this tutorial this give me some Ideas on how the input system to be used.

  • @pyakpepyak
    @pyakpepyak ปีที่แล้ว +1

    You don't really need a separate ActionInputManager script just to enable or disable input asset. It all can be done via corresponding InputActionReference in your TestScript

    • @xepherin_dev
      @xepherin_dev  ปีที่แล้ว +1

      For sure you can. This is the way Unity does it in their XR Interaction Toolkit so its just what I'm familiar with. You can also just add InputActions instead of InputActionReferences to skip the InputActionAsset altogether and do it all in the Inspector and enable the Actions themselves in your script. It's all in what you prefer.

  • @njerurichard3581
    @njerurichard3581 ปีที่แล้ว +2

    Hi. Any pointers on how to implement this for touch screens? Particularly how to use for example two buttons for left and right instead of an onscreen joystick. I am honestly at my wits end.

    • @StinkySteak
      @StinkySteak ปีที่แล้ว

      There is OnScreenButton script, there is also a small doc about it

    • @njerurichard3581
      @njerurichard3581 ปีที่แล้ว +1

      I am aware of that, but implementing it and tying it back to the input asset is a whole different matter. I know it sounds and looks trivial, but it is not.

    • @xepherin_dev
      @xepherin_dev  ปีที่แล้ว

      Unfortunatly, mobile games is not something I have a ton of practice in. In the past, I've gotten a touch as two speparate InputActions, one for the touch event and one for the screen position [which you have to convert to world space through Camera.main.ScreenToWorldPoint()]. and then code a joystick from scratch. for buttons, I would just stick to the unity UI buttons as much as possible. For reading the input I would subscribe to an event on the touch and then Camera.main.ScreenToWorldPoint(touchPos.action.ReadValue()); within that event. Hope this helps!

  • @enesgamedev
    @enesgamedev ปีที่แล้ว +1

    thx

  • @rubenvidorreta8082
    @rubenvidorreta8082 ปีที่แล้ว +1

    Isn't just better to generate the C# class from the input action asset and use the interface given? It is easier for me at least

    • @xepherin_dev
      @xepherin_dev  ปีที่แล้ว +1

      Definately you can do that! I prefer serializing as it's a hair faster due to all the string comparisons and C#'s static not being super fast. But if you're getting it all on startup and want to keep it all in the code that's definately a good way to keep it clean.