How to use TOUCH with the NEW Input System in Unity

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

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

  • @samyam
    @samyam  7 หลายเดือนก่อน +1

    Wishlist my new game BUMBI on Steam! store.steampowered.com/app/2862470/BUMBI/

  • @justusforan
    @justusforan ปีที่แล้ว +8

    Sam you understand this input system on a different level. Thank you for putting in all this work!!

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

    I've come back to this video twice, and twice found the solutions I needed lmao. Thanks a lot!

  • @phontum
    @phontum ปีที่แล้ว +19

    This is pretty weird, but for those who use Unity Remote to test things out for your mobile app, please keep in mind that the New Input System is not supported in Remote yet (it's been 3 years already :/ ). To test your controls. you will need to actually build the app. I found this after 3 hours "fixing" my game...

    • @GaLzZy.
      @GaLzZy. หลายเดือนก่อน

      I have that issue, what do you mean by "build the app"? because whenever I do "Build and Run" the input still doesn't work... Thanks!

  • @asadickens9353
    @asadickens9353 ปีที่แล้ว +6

    Really digging all the Input System videos that you have made! This one I thought had a lot of information that is easy to digest! I sent it to my designers so they can watch it and get a feel for the tool! It's always exciting to see how Unity evolves!!!

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

      thank you!!

  • @thenewaeon
    @thenewaeon ปีที่แล้ว +9

    Heads up: if you are like me, in the input debugger, you may need to right click on "Mouse" in the devices list and click "Enable Device" before the simulated touchscreen will return any values for clicks etc..

    • @RiverGrove-p7v
      @RiverGrove-p7v ปีที่แล้ว

      Good to know

    • @BenGlasser79
      @BenGlasser79 8 หลายเดือนก่อน

      dude. I searched the entire internet for this comment. you're a lifesaver my guy 🙏

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

    Somehow, you are there to answer all my questions. I appreciate your tutorials SO MUCH. THANK YOU!

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

    I've really been thinking about starting a simple mobile game after this current project and I use the new input system religiously at this point so very informative! I remember using the old system to try and set up a simple movement system based on starting touch. It wasn't fun from what I can remember (several years ago).

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

    good to finally put a voice to the twitter user - also wonderful video, gonna be using this at some point

  • @autocivil
    @autocivil ปีที่แล้ว +7

    why we use EnhancedTouch.Touch.onFingerDown += Touch_onFingerDown; in start() not in Enable() so we can unsubscribe in Disable()??

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

      On Enable would be better, I was showcasing the function and it slipped my mind.

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

    best description: new but not so new input system 😆

  • @fruitfunfitness3584
    @fruitfunfitness3584 21 วันที่ผ่านมา

    As a value action type, TouchPosition would change whenever the position value changes. This is consistent with other value action types. That could mean you're sliding your finger and it's triggering every frame (by default, input is collected on Update). TouchPress on the other hand will require a physical press, but will not pass through the position data by itself. That's my take.

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

    Best explenation of the new input system I could find! Definitely going to give it a try now. 😅Nice video!

  • @FrancescoLogli
    @FrancescoLogli 5 วันที่ผ่านมา

    Hi Sam, how can I set up the functionality to use two fingers to rotate a 3D object? I'd like to achieve a result similar to what's commonly done in 3D viewers: using one finger to move the object, pinch-to-zoom with two fingers, and rotating the object by moving two fingers in a circular motion.
    Could you give me some guidance on how to set up the parameters in the Input Action Editor ? Thanks! 🤟

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

    thx Sam, I needed this and you made the video right on time lol

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

    Lady...I learned and enjoyed it, thanks!

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

    im so overwhelmed

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

    Thank you very much for making these tutorials ❤

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

    Thanks for the help samyam :D

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

    The google is not recommending me the touch about touching objects not clicking screen, what the heck.

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

    Thanks, but i want onscreen buttons touch input instead of finding the touch position. Eg. i want to assign "A" key into a touch buttton, I know this can be achieved with a script comes with new input system. but if i touch a button and slide my finger outside the button area, the touch input still keeps on pressing the button. So how to implement the "on pointer down/up/enter/exit" with new input system..., Thanks

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

    Best information thanks! subscribed

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

      thank you!

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

    Great video!

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

    That's really really nice 🙂

  • @Rawezhkurd256
    @Rawezhkurd256 2 หลายเดือนก่อน

    Hi Samyam Thanks For Your Great Video I Have One Question , I have Some Object Like `House , Car , Tower etc` How To Detect That User Touch It Or Not , Before I Used `Raycast` And `Update Method` To Detected , Any Chance To Detected With ThisNEW Input System ??????

  • @chengli-n3f
    @chengli-n3f 3 หลายเดือนก่อน

    How to determine whether a click on a mobile device using Unity's new input system is on the UI or on a 3D object?

  • @MrKiraBR
    @MrKiraBR 2 หลายเดือนก่อน

    I'm having a weird issue... please help! When I swipe, the onperformed action gets called multiple times, even though I set only one control.

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

    I like the new touch system. Great video but how do I get a pressed/touched object?

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

    For some reason, the player.transform.position changes once to 0,1,-10.

    • @legionsquad6111
      @legionsquad6111 10 หลายเดือนก่อน

      did you find the issue?

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

    Thank you very much !

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

    why the touch is registering even when i touched outside game view . an even when i stopped the game still showing Logs when i touch everywhere

  • @wealdcreative
    @wealdcreative 4 หลายเดือนก่อน

    I can't get the Input Debugger to simulate touch drag events. It doesn't create a Touch control scheme when simulating touch.

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

    Good Work SamYam. I have a question. Is this new input system with Touch compatible with Unity Remote 5 ? I tested but it did not read the touch position. Maybe i made someting wrong. You know it eases the worload without building the project for mobile.

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

      I don’t think it is unfortunately, they haven’t updated that app in years forum.unity.com/threads/new-input-system-and-unity-remote-5.735968/page-4

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

    Me: (watching this video)
    Also Me: (About to fall asleep)

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

    You are the best.

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

    Bro just casually got sponsored by unity

  • @GameplayGoon
    @GameplayGoon ปีที่แล้ว +3

    I’ve been after a invisible touch screen joystick tutorial, the one you get on most modern portrait mobile games for player movement.
    I imagine having an on screen analog/joystick that stretches to the whole canvas size would do the job. - I’m still not sure how to do this as I tried for countless hours and decided to compromise to a different movement system.
    Can’t find a tutorial anywhere. Can you be the first one to make it 😅 would really appreciate it.
    Btw great video
    Thanks a thousand.

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

      Thanks! Maybe in the future I will make the video! I have some cool tutorials planned for the near-term right now :)

  • @Sanchez9241
    @Sanchez9241 4 หลายเดือนก่อน

    16:11 why screen 0.0 coordinates are at top left corner& offical unity documentation tells that 0.0 is bottom left corner and 1.1 is top right corner

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

    Thank you so much for doing these videos. The unity documentation, in my opinion, is trash. It's so hard to find the information that I need, but your videos explain how to use it so well, I don't have to go digging.

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

    not gonna lie, when I compare setting up touch controllers with the New input system, vs adding a collider, event trigger component or Button component, is x1000 easier using the event or button component for touch buttons. I am looking forward to use the new input system only because with events I cannot manage to detect more than one finger input at the same time. but I cannot believe how complicated it is.

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

    it doesn't work. Not matter what I try. I get "Screen position out of view frustum (screen pos inf, -inf, 0.000000)" error.

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

      Same here, have you solved it?

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

      @@Terajoel I guess it's a version issue

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

      I'm sure it's a version issue! It bothered me for a long time, but I have no problem with the same code in Unity6!

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

    Thanks Sam! amazing video. I have a question. Why i can not move the object smoothly where my finger is pressing, i mean while my fingen is on press. Because looks like the object is teleporting to the position where my finger is. i would like to move an object but in a smoothly way. Thanks again i am so glad you are doing this videos.!!

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

    In the case of window standalone using multiple touch screen monitors, touch coordinates are recognized strangely when building. What should I do?

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

    Awesome video! Do the touch inputs work when exported to WebGL, and played in a mobile phone's web browser?

    • @malwida1022
      @malwida1022 11 หลายเดือนก่อน

      I had the same question, did you ever find out? May save me some headache, thanks!

  • @MrKiraBR
    @MrKiraBR 2 หลายเดือนก่อน

    Thank yoou!

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

    Is there anyway to tell if you touched the left or right side of a screen in portrait mode?

  • @MuhammadMuhammad-xv8rf
    @MuhammadMuhammad-xv8rf ปีที่แล้ว

    how i can limit the Right stick input on an image but not with the OnScreen Stick, like looking on mobile devices happen i have seen it in Third person controller made by unity but it is done by right stick i hope it is understandable

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

    When the touch is released, how can I get the coordinates of when it was released? canceled returns 0, 0, 0.

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

    I don't think I understand this enough. I am trying to listen whenever the touch phase is changed and then get the phase to only do something on Moved. I selected Touch as the control type and path to primary touch. It seems to only run when the phase is changed, but I can't seem to return the touch so I can check the phase. I might just end up using the enhanced touch, but I don't think I need the finger returned and I think it's worse for performance? Idk I could really use a little more clarity and documents aren't working for me. Please help.

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

    Does this also work with multitouch on Windows (e.g. on Surface tablets)?

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

    Off topic, but how did you make the font of the unity interface bold and flat?

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

    What is the best approach to call a function in another class for the action callback? For example: If I need to define "TouchPressed" in another class, is it better to make it static Class2.TouchPressed?

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

    I keep getting the same position coordinates when I click on the screen. (0.0, 1.00, -10.00). Doesn't matter where I click on the screen it returns this value and the circle just jumps to (0.0, 1.0, 0.0). no interaction. I have gone through the video three times and still get the same results. HELP!

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

    On the first TouchPressed() the touchPositionAction is always (0.00, 0.00), I guess since it's the first touch it "hasn't moved yet".
    Is there a way to get the position of the very first TouchPress?.

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

      nvm just changed the Action to Value > Vector2 and Path to primaryTouch > startPosition

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

      I had a very similar problem. On the first click, the circle would move to 0, 0. Then on every subsequent click, it would move to the position of the PREVIOUS click (so it would lag behind by one click). I couldn't figure out why until I went back into the Input Actions and saw that the path for "TouchPosition" was set to Touch #0 > Position instead of simply Position. Fixed that, and now it works as it should. :)

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

    strange that enhancedTouch seems to completely bypass normal inout system and related actions!

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

    so how would I have it where falling objects from the top of the screen get destroyed every time you touch them? new to unity and touch and this is confusing to me.

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

      I recommend this video of mine! th-cam.com/video/JID7YaHAtKA/w-d-xo.html

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

    Hey, @Samyam. In the Awake() method @ 15:22 (playerInput = GetComponent(); ), I am getting an error : UNT0014: ‘PlayerInput’ is not a Unity Component. What could be the issue?

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

      did you include "using InputSystem" up at the very top

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

      using UnityEngine.InputSystem;

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

      @@samyam My bad

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

      @@samyam Yes. I did. The reference seems to be the issue of the other script.

  • @StickyLabDev
    @StickyLabDev 7 หลายเดือนก่อน

    what i need to know,,,,,,,,,,,when i click ui button , it should not click the touch

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

    awesome

  • @meowoha
    @meowoha 7 หลายเดือนก่อน

    感谢分享~希望知道如何使我的UI可以屏蔽触摸输入(例如希望在我触摸屏幕时角色会发起攻击,但当我点击游戏暂停按钮时角色不会发起攻击)

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

    Thanks

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

    Love you

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

    After this Video im just totaly confused how to setup a simple Touchinput to jump in my game xD
    Well maybe i will try it someday but this system is pretty confusing because this context stuff makes absolutly no sense in my brain 🤷‍♂
    Im coming from Unreal and started to love Unity for its simplicity but that InputSystem is rly uncomfortable to work with holy cow 😢

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

    Hey does anyone experience any "lag" on the touch position when playing on mobile? So in a test scene of mine (just a simple square sprite) I have an easy implementation with a dragging functionality that uses the Input system and works fine when tested in the unity editor. When building and playing it on my phone/tablet it still works but I can see a little to medium lag in the dragging. So the Square is always trying to catch up with the touch position by a delay of maybe 0.2-0.5 seconds (so its not a lot, but you really feel it). I think there is no problem with my code or my input asset configuration as its very simple and I checked it many times... Is there maybe some setting in the build settings that should be adjusted or something to consider when implementing on mobile in general?
    Thanks in advance and thanks for the nice vid :)
    p.s. is your video on drag and drop still up to date?
    cheers

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

      Should be up to date! Are there any errors in the scene? We also have a Discord in our description where you can join and ask in the help channel to add more details and images

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

      @@samyam OK great then I will check your drag video again! And no there are no errors or warnings. Everything seems to work fine. It just seems that the rate at which the input-data gets processed on my mobile devices is too slow. Will head to the Discord :)

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

    Can u do on multiple players game articture

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

    does anyone else encountered an issue where the first touch position is always the left bottom corner of the game tab? no matter what. This seems like a bug in the new input system

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

      Make sure your TouchPosition input action has a proper binding. I was having this issue before realizing it was because I didn't set the binding to be "position".

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

    Can someone tell me what I have to do to get the IDE to recognize things like "Getcomponent" to light up in color. How I tell the IDE to know what I mean? The color remains basic white with no change on certain texts. Do I need to do a PIP install for something? Same thing with PlayerInput isn't orange; it is just white like the IDE doesn't understand what I enter. I feel like my IDE is missing definitions or.....something. I don't know. I am rather new to all this & don't have any tech friends to ask about this.

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

      What IDE are you using? You can also join our Discord and ask in the help channel

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

      @@samyam MS Visual Studio. I am about to leave for work; so if you happen to reply I may be late to respond. I appreciate the help.

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

      Try asking on our discord, i don’t use MS visual studio, maybe this can help th-cam.com/video/kfuBAhIGzrY/w-d-xo.html
      it’s called “intellisense” the thing that recognizes the code and highlights it

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

      @@samyam Ok thank you. More help than I've ever gotten from any Udemy instructor lol. Btw when I clicked your discord link in the bio of the video it said the invite has expired. Might just be an issue on my end.
      Thank you for taking the time to respond before; I greatly appreciated it.

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

      No worries!
      discord.gg/SwCKB3Q

  • @pashamlakshminivas
    @pashamlakshminivas 11 หลายเดือนก่อน

    Is it same for 3d games or is it only used for 2d games

    • @samyam
      @samyam  11 หลายเดือนก่อน +1

      This detects touch which you can use for any kind of game you want! How you implement the functionality is up to you

    • @pashamlakshminivas
      @pashamlakshminivas 11 หลายเดือนก่อน

      @@samyam I had completed this tutorial now can I implement same for 3d game

  • @mohokhachai
    @mohokhachai 9 หลายเดือนก่อน

    Choose the best event handler

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

    Hey I sent you a message on Paetron about the the racing game project.

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

    How do i do hold?

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

    This is great but it’s sad Unity’s new system is so convoluted people need to come here to look for how to use it. They really need a lesson in input handling from Godot.

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

    Check you out, helping us normies yet again with Unity's input system. 😏 Thank you for this! One step closer to having a mobile dungeon crawler.

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

      🙌🙌

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

    can you make this in 3D, kinda messed up if i try in 3d -_-

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

      touch is always in 2d screen coordinates, if you want to convert that into Unity 3D coordinates i have a video th-cam.com/video/JID7YaHAtKA/w-d-xo.html

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

      @@samyam nice thank you so much

  • @Abdulwahab-vb6he
    @Abdulwahab-vb6he ปีที่แล้ว

    Solid principals, desgin pattrens............?

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

    genuienly ununderstandable.

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

    Sent you a reply on Patreon.

  • @JhonSabowsla
    @JhonSabowsla 6 หลายเดือนก่อน

    what did i just see

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

    𝙥𝙧𝙤𝙢𝙤𝙨𝙢 💕

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

    Thanks for the amazing video !
    I was using Enhanched Touch in my script and wanted to check if the touch was on a UI element. I have used the pointer over game object but it does not seem to work
    if (EventSystem.current.IsPointerOverGameObject(finger.index)) { return; }