Hmmm I've subscribed because yesterday I've found a really good video on your channel and today looking for some information about this I found your channel again. So thank you again xDD
Vector 2 to Vector 3 I was not sure how to do at first. Some may see that up on controller will use y for your rigid body. To have it use Z instead look at line 44 at 4:42 in the video. You need to have a new Vector 3 set to your (vector2.x, 0, vector2,y). Now your movement will work correct instead of up going up compared to the plane.
I have a problem with this, in the video it seems like when you set it up it works fine with both mouse inputs and phone touch inputs. I tried it myself with my mouse and then with unity remote for my phone(iphone and android tablet) it allows me to move the UI joystick but not the player for some reason
InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings. If you ever get this error just go to project settings> Plater> other settings> active input handling> and change it to BOTH
Yeah that means you are using the old one somewhere, which I suggest not using both unless you have no choice (maybe a package you are using uses the old one). That may be the Event System using the old system, but it's hard to say without seeing the project.
Thanks! I love the content you are providing. FWIW I had one small problem. I noticed that the UI image wasn't moving around for me (see about 1:30 in the video). I fixed this problem by going into my EventSystem game object and changing from "Stand Alone Input Module" to the new InputSystemUIInputModule. If anyone else has a similar problem you may have a similar issue.
Hi Jason, I've changed to InputSystemUIInputModule in the event system but I still have this issue. The WASD controls move me but the joystick image doesn't move and therefore won't move on Android :( Any ideas?
Update: I had added the PlayerControls Input Actions asset to the event system, after reverting and using defaults it now works as this brilliant video shows
If someone runs into a problem like not working in the next scene, plz remember to put that EventSystem object under your UI_Canvans, which has a Singleton generic set up already.
Is there a way to "transfer" your "touch" from one button to another? I am trying to do as follows: There is "one" joystick on screen. But before it is running its joystick logic, you have to hold it for a second. The way it is setup is there is a regular "on screen button", behind this button is an image (circular slider), and behind the slider is the joystick. So what happens is you can tap the button and your tap will not be detected by the joystick (since the button is on top of it). This is fine, because the button can be the one that runs the slider (if you hold the button, the slider fills up over time, and if you release it, then the slider empties over time). If the slider becomes completely empty, it disappears. If the slider is FULL then the button AND the slider disappear. Now the joystick is available since the button and the slider, which were on top, have disappeared. Now the issue is that your touch input, which is what you used to tap and hold the button, isn't being detected by the joystick. You have to release your original touch and then touch again, this time the joystick is directly touchable since the button and slider are gone. So a solution would be for the joystick to detect touch if you DO NOT drag, so that the player can hold the joystick, which at the moment, IsPressed(), started, performed are NOT firing until you start dragging (so it doesn't look like it can be used to run the button's code, which is expecting the player to hold the button). Another solution would be to somehow transfer the original touch from the button to the joystick. That way when the button and slider disappear, the joystick takes over that touch input. Any clue how to do this? The idea is to have the player hold the joystick for like 2 seconds before the joystick becomes enabled. To give the player visual feedback, I added a circle slider which when full makes the joystick usable. So far, I have a button that runs the "touch and hold" logic (and slider). But once the "hold" action is complete, my joystick isn't detecting the input until the user released the original touch input and re-touches the joystick. It's setup as button in the front, slider behind it, joystick behind all that. That way, as the button and slider are enabled/disabled, the user can't tell (since they're using the same image asset).
Whenever I open a tutorial video. The trainers ask us to watch 250 videos they shot by saying "Yes, I showed this, I told you about it, you already know that". Just to watch and understand one video. This makes it even more complicated. I really don't understand why you are doing this.
They make content. You are watching this for free to learn something. It's like 5 minutes long. This video doesn't show complete system cause it doesn't need to. Soooo go watch the other video that is also free and stop thinking the world is going to hand you everything in life.
Eu também achei, consegui implementar facilmente. Porém eu só queria uma função, onde eu tocasse, o joystick acompanhasse... Mas assim já está de bom tamanho.
So, I already added a keyboard and mouse controls with this input system and they work just fine. I wanted to add mobile support, so I used this tutorial and added a control scheme with the controls exactly how you showed. However, even in simulator screen, I can move the UI images with the mouse but the player doesnt move at all. I have no idea why?
At 1:53 you choose Gamepad instead of Joystick even though this is a tutorial about adding a joystick control. Is there a reason why? After you clicked Gamepad you then clicked Left Stick. If you click Joystick it's basically the same except it just says Stick. Are the Left and Right Sticks in Gamepad different from the Stick in Joystick? Or are they the same? I'm probably just overthinking this so sorry if this is an unnecessary question. And thank you for this tutorial!
first of all thanks for the video. I have a question for you. Why does the joystick that I add in my Canvas not move in the editor or mobile device? where am i doing wrong?
Madzam you finished the video b4 linking the continuation of the video where you put the codezzzzz... assume its a totally new viewer accessing this video randomly
Does this work for anyone? I feel completely lost. I did what she did, but nothing moves. Trying to follow this video for over half an hour, but no success. It's sad that 20% of the video is about selecting an image instead of how to get this working properly
I made a game with wasd controls, and now i want to make a mobile version of it, though its gonna take forever to remake everything for mobile, so is their an easy way to change it in the same script maybe? Edit: I forgot to mention that I dont want joysticks, instead id like arrow buttons. is there a way for a button to receive the same input message as a keyboard arrow? like make the button on screen behave like the one on the keyboard?
The input system is designed to be easy to adapt for different consoles. What you can do is have 4 on screen buttons and each one overrides the control that you currently have bound, for example have one button override the up arrow key or W. It should “act” as those values and you shouldn’t need to change much in the code. Let me know if that helps!
Yeah I have some videos on using the UI with the new system, although I don’t have a dedicated video of on screen buttons Enable UI with the new system ua-cam.com/video/TBcfhJoCVQo/v-deo.html Controller and Keyboard Menu Navigation ua-cam.com/video/Hn804Wgr3KE/v-deo.html Joystick ua-cam.com/video/zd75Jq37R60/v-deo.html ^ Concept should be similar as in the joystick video but use on screen button instead
Is there a tutorial of yours where you explain step by step how to code the character script instead just to copy from the documentation? thanks for the tutorial. :D
see earlier comment: I noticed that the UI image wasn't moving around for me (see about 1:30 in the video). I fixed this problem by going into my EventSystem game object and changing from "Stand Alone Input Module" to the new InputSystemUIInputModule. If anyone else has a similar problem you may have a similar issue.
great video! is there a tutorial for how to make the camera just be controlled by swiping on the screen (like minecraft does it)? thanks so much edit: forgot to mention first person as well
Yeah! The video is a little older but I did a third person video of that ua-cam.com/video/YV5KOZHsIz4/v-deo.html (Basically as a hack you can make the joystick invisible and place it over the are you want the player to swipe then pipe that input to your camera look) I have a separate first person controller video (without joystick) ua-cam.com/video/5n_hmqHdijM/v-deo.html And since then I found an easier way to replace the cinemachine old input system values (cinemachine input provider) ua-cam.com/video/we4CGmkPQ6Q/v-deo.html
@@samyam thank you for these however i am not having any luck. i wont go into why it doesnt work for me as its a somewhat long explaination, but to simplify it, it feels very unresponsive. rotating the camera based on the finger's position when the screen is first pressed compared to its current position would make it feel much better i think. however im not really sure how to go about doing that using the new input system, as i dont know how to get a constantly updating vector2 of the current position of the screen press
When you start pressing, you can start a coroutine that checks every frame for the position and updates the camera accordingly: // pseudo code (sry on phone kinda messy) Coroutine c; OnStartTouch() { c = StartCoroutine(UpdateTouch) } OnEndTouch() { StopCoroutine(c) } IENumerator UpdateTouch() { while (true) { // or instead you can check if the finger is pressed and not have to do a StopCoroutine call vec2 v = get finger position camera.transform.position or rotation = finger position yield return null; } }
@@samyam this worked great, but i do have a new problem. i can now only interact with my other buttons with right click. this might not be an issue as it could just be simulating a different finger, however i dont have the ability to export it to my phone right now to test. something that is definitely an issue is that when i interact with right click it still rotates the camera. how can i make the camera only rotate when being pressed off of the buttons? thank you for your help so far
question how can i change the right joystick to look around to just use the right side of the screen so i can put another button there for lke jump or slide etc. (also how can i make the movement have exceleration? so the more you move character the faster it gets)
Hi samyam, i got a problem with touch input. i followed your procedure and its working on some devices but not on all. it gives laggy output. Actually, its not working on my own phone but on other extra android devices that i have it is working fine. I want to know what could be the reason for this laggy output movement on using an on-screen stick. I have checked my phone's performance and touch inputs but nothing seems to be working. PLEASE HELP !!!!!!!!!!!!
this is because of unity remote 5... im banging my heads against the wall too. apparently using Input System version 1.1.0-preview.3 works for some cases... just change the version number in ur manifest.json file
I had an issue with laggy joystick too, not sure if yours is same but I fixed it by moving my controls script at gameobject inspector above the rigidbody/collider. So probably the issue is because of priority of components, if physics components are first, the engine is doing physics calculations THEN doing what you have in your controls script, and it's the reason why it's laggy.
I've a problem with the joystick..... Whenever I move a joystick (little bit) the speed of the player is slow but when I move joystick farther the speed is normal...I'm using 2D rootMotion.... Can you please help....
That's normal, the joystick will give you smaller values if it's closer to the center. You can normalize the value manually or add a Normalize Processor to your action ua-cam.com/video/17VqOh3_zxU/v-deo.html
I follow the video but I don't necassarily get the implementation into code. I am trying to use a joystick that essientially if held down (pass through i'm assuiming) triggers one function, if held up triggers another function... etc.
Great video! I have a question though. How can I enable input detection just tapping anywhere on the screen but not only Canvas left-pad that we did in the video?
Do you mean from anywhere in the screen move the joystick? You can make an invisible image covering the whole screen and attach the on screen joystick to it as a workaround, and then have a joystick image mimic the movement you are making on the invisible image for visual feedback. Is that what you mean?
@@samyam That's exactly what I meant. I made image with alpha 0 full-sized, and its working like a charm, thanks a bunch! I should have thought about that :D
I have a problem when using this. Even when I'm not touching the joystick image, but when my click/touch is in the proximity, the joystick gets selected and moves. This interferes with other buttons that are near by.
Dear Samyam, Can you help me make floating joystick on mobile with the Unity Starter Assets FPS controller, I cannot get it working, I have been on this a looooooong time can you help me?
I'm new to unity and was trying the to create an on-screen joystick using this tutorial. But I'm currently running to an issue where I cannot move the on-screen stick when testing on android. The stick can move when testing on windows. What should I check/setup in order to fix this? Edit: Tested the Input System samples (on screen controls and touch samples) but still experiencing the same issue. Using Input System v1.0.2 on Unity Editor 2020.3.11f1 Thanks
Try using Input System version 1.1.0-preview.3 (in the package manager, in the settings up at top, click advanced project settings and there will be an option to enable preview packages) forum.unity.com/threads/on-screen-joystick-sticking-on-android.1005158/
After several testing, it seems that the problem is with the unity remote 5 and not with the input system as the controls work after building as an apk
Yes it’s fine in any games or projects. but if you are taking the code from my patreon and distributing it as your own without any substancial changes then that’s not allowed.
On the back end the input system has to run on every frame anyways to detect input so I wouldn’t think there would be much of a frame rate difference. You can run a quick profiler test using simple input to test it.
Hmm that’s not currently in my plans, I’m using the new system for most of my videos since that’s what unity will eventually one day switch to. But my videos shouldn’t be too hard to adapt to using the old system. Here is my third person video ua-cam.com/video/ImuCx_XVaEQ/v-deo.html
Well, what errors do you have? If you don’t want to use the On Screen Joystick that’s provided you can make your own. Or use the one Unity made in their new Starter Assets ua-cam.com/video/CD0FlqllfIE/v-deo.html
@@samyam Thanks! Ive also discovered the ploblem, slince I've change the build settings to android, some of the computer controls where still there. Thats probably why.
Hi, this video is great and helped out a lot. But I was wondering if there's a way to make the joystick more customizable. Before I switched to the new input actions I downloaded a free joystick asset pack and the controls on those feel better because of possibly lower dead zone and the fact that the center of the joystick can move according the finger's position.
Yeah you can change the On Screen Joystick script to fit your needs (or make your own joystick and follow their example). The new starter assets from unity also has a Virtual Joystick script with different functionality ua-cam.com/video/CD0FlqllfIE/v-deo.html
Hello, thank you for this nice video, but i have a question. Houw to make this controller for 2D platformer games using virtual buttons? I can't to finde some tutorial about it, because many tuts are with joystick. If it possible to make some video, would be great. Or maybe just help me. Because on Unity Editor virtual buttons works good, but when i make Build for testing on Mobile, there are some bugs (player do not move or moving with lottle steps after many tap on buttons)... Maybe some bad Interactions setting... I don't know... I stuck with this 🤷🏻
Hi!, I'm using a game pad, and I have an issue. Maybe you can help :). My character has a blend-tree to manage the IDLE and move animations, and when I let the analog stick go back quickly to the center, the blend transition from run to IDLE go too fast. When I use keyboard this transition is OK. Any idea?.
Try printing out the values from the analog stick to see what values are getting registered (or use the input debugger ua-cam.com/video/ICh1ZEaVUjc/v-deo.html)
How do you read the playerInput values from the PlayerController script? What is playerInput an instance of? The component is called "Player Input" but I can't find anything like that when I try to reference it in code
You have to include the InputSystem namespace using UnityEngine.InputSystem; Then you can do: PlayerInput playerInput = GetComponent(); InputAction moveAction = playerInput.actions["Move"]; moveAction.ReadValue(); as an example
That shouldn’t impact your keyboard input if you added another binding under your Movement action. But you can just delete the gameobject you made with the Stick
@@samyam thanks! Yeah I tried this! All of those 3 settings! I'll dig more. I was wondering if there were overriding settings at project level too maybe.
@@samyam it's like I can tap the jump button (a button instead of right stick) and it doesn't register unless I'm not using the left stick. It feels like the focus changes a bit like switching between inputs . But this is all on mobile
Come on man... I works 3 weeks on this this and finally I finish that here
🥳❤❤❤❤❤ thanx alot
first person with a twitter user pfp that is actually helpful and doesnt make people wanna die, cool.
Where were you all my life? The best and easiest movement tutorial ever!!!!!!!!!!!!!!!!!
So easy, so nice! I love the voice of this woman! thanks!
Thanks!!
This tutorial deserve thousands of subs thanks sam
I have been looking for a simple solution for all of yesterday. I'm so happy I found your video
Hmmm I've subscribed because yesterday I've found a really good video on your channel and today looking for some information about this I found your channel again. So thank you again xDD
Woot woot! Thanks 😄
She can read yo mind buddy decades later i needed this too nice
@@samyam make video how to do it with 2d
@@grandprime2014 it's same
@@grandprime2014 use button for 2D though if it's top down joy stick is better and all the process is same
Vector 2 to Vector 3 I was not sure how to do at first. Some may see that up on controller will use y for your rigid body. To have it use Z instead look at line 44 at 4:42 in the video. You need to have a new Vector 3 set to your (vector2.x, 0, vector2,y). Now your movement will work correct instead of up going up compared to the plane.
The anchor presets is not working properly.
Oh i was just dumb, i didn't read the Alt+Shift.
I have a problem with this, in the video it seems like when you set it up it works fine with both mouse inputs and phone touch inputs. I tried it myself with my mouse and then with unity remote for my phone(iphone and android tablet) it allows me to move the UI joystick but not the player for some reason
InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
If you ever get this error just go to project settings> Plater> other settings> active input handling> and change it to BOTH
Yeah that means you are using the old one somewhere, which I suggest not using both unless you have no choice (maybe a package you are using uses the old one). That may be the Event System using the old system, but it's hard to say without seeing the project.
Really like your channel. Good job
Thanks!
After over a half hour, got it to work, thanks
Thank you a lot for those tutorials! You really have been helping my to understand how the new input system works
I am a bit confused, when did you set up your player/animations? is this a second part of a video? Could you direct me to the video if so.
Thanks! I love the content you are providing. FWIW I had one small problem. I noticed that the UI image wasn't moving around for me (see about 1:30 in the video). I fixed this problem by going into my EventSystem game object and changing from "Stand Alone Input Module" to the new InputSystemUIInputModule. If anyone else has a similar problem you may have a similar issue.
Thank you! :)
thanks
Hi Jason, I've changed to InputSystemUIInputModule in the event system but I still have this issue. The WASD controls move me but the joystick image doesn't move and therefore won't move on Android :( Any ideas?
Update: I had added the PlayerControls Input Actions asset to the event system, after reverting and using defaults it now works as this brilliant video shows
This man is the mvp right here
Simple and comprehensible. Thanks)
Thanks for the tutorial - this Unity input is so convoluted. Godot FTW!
Thanks a lot, lots of useful info and good practice tips here
Thanks why are you so extremely underated
Thank you! :)
This is such a life saver, tysm!!!!
Thanks Sis Love your Work, it helped me a lot and saved my day. best of LUCK
If someone runs into a problem like not working in the next scene, plz remember to put that EventSystem object under your UI_Canvans, which has a Singleton generic set up already.
It's Really Helpful!!! thank you for making it easy and simple to understand!!
Awesome!
Is there a way to "transfer" your "touch" from one button to another? I am trying to do as follows: There is "one" joystick on screen. But before it is running its joystick logic, you have to hold it for a second. The way it is setup is there is a regular "on screen button", behind this button is an image (circular slider), and behind the slider is the joystick. So what happens is you can tap the button and your tap will not be detected by the joystick (since the button is on top of it). This is fine, because the button can be the one that runs the slider (if you hold the button, the slider fills up over time, and if you release it, then the slider empties over time). If the slider becomes completely empty, it disappears. If the slider is FULL then the button AND the slider disappear. Now the joystick is available since the button and the slider, which were on top, have disappeared.
Now the issue is that your touch input, which is what you used to tap and hold the button, isn't being detected by the joystick. You have to release your original touch and then touch again, this time the joystick is directly touchable since the button and slider are gone.
So a solution would be for the joystick to detect touch if you DO NOT drag, so that the player can hold the joystick, which at the moment, IsPressed(), started, performed are NOT firing until you start dragging (so it doesn't look like it can be used to run the button's code, which is expecting the player to hold the button).
Another solution would be to somehow transfer the original touch from the button to the joystick. That way when the button and slider disappear, the joystick takes over that touch input.
Any clue how to do this? The idea is to have the player hold the joystick for like 2 seconds before the joystick becomes enabled. To give the player visual feedback, I added a circle slider which when full makes the joystick usable. So far, I have a button that runs the "touch and hold" logic (and slider). But once the "hold" action is complete, my joystick isn't detecting the input until the user released the original touch input and re-touches the joystick.
It's setup as button in the front, slider behind it, joystick behind all that. That way, as the button and slider are enabled/disabled, the user can't tell (since they're using the same image asset).
thank you
Unity input system is good!
i'm made high quality controller !
Whenever I open a tutorial video. The trainers ask us to watch 250 videos they shot by saying "Yes, I showed this, I told you about it, you already know that". Just to watch and understand one video. This makes it even more complicated. I really don't understand why you are doing this.
Dawg its really not that hard
They make content. You are watching this for free to learn something. It's like 5 minutes long. This video doesn't show complete system cause it doesn't need to. Soooo go watch the other video that is also free and stop thinking the world is going to hand you everything in life.
Thank you so much! You're a legend
Sensacional o video, extremamente organizado e direto ao ponto! Parabens!
Eu também achei, consegui implementar facilmente. Porém eu só queria uma função, onde eu tocasse, o joystick acompanhasse... Mas assim já está de bom tamanho.
Thank you a lot for those tutorials!
this is amazing , but how to replace left stick with full screen touchpad ?
So, I already added a keyboard and mouse controls with this input system and they work just fine. I wanted to add mobile support, so I used this tutorial and added a control scheme with the controls exactly how you showed. However, even in simulator screen, I can move the UI images with the mouse but the player doesnt move at all. I have no idea why?
At 1:53 you choose Gamepad instead of Joystick even though this is a tutorial about adding a joystick control. Is there a reason why? After you clicked Gamepad you then clicked Left Stick. If you click Joystick it's basically the same except it just says Stick. Are the Left and Right Sticks in Gamepad different from the Stick in Joystick? Or are they the same? I'm probably just overthinking this so sorry if this is an unnecessary question. And thank you for this tutorial!
Gracias, te amo ❤, nadie fue tan claro como tu.
Thanks, but for some reason it wont move for me. I ALWAYS have trouble setting up input on a new project :(
Daaaamn, this channel is solid. Subbbbbed!
Thanks 😄
first of all thanks for the video. I have a question for you. Why does the joystick that I add in my Canvas not move in the editor or mobile device? where am i doing wrong?
great tutorial
Madzam you finished the video b4 linking the continuation of the video where you put the codezzzzz... assume its a totally new viewer accessing this video randomly
awesome video! I'm trying to learn the new Input System and your videos certainly help
omg so pro, I wish I were at your level
practice makes perfect :)
Well done!
If I want to make it work on a mobile should I still keep it as gamepad left joystick?
Succinct. Useful. Inspiring. Thank you!
Thanks for the nice words! 😄
NO.
It goes well with a console controller, but it does not go with the SmarthPhone
Does this work for anyone? I feel completely lost. I did what she did, but nothing moves. Trying to follow this video for over half an hour, but no success. It's sad that 20% of the video is about selecting an image instead of how to get this working properly
Very helpful I subscribed 💝💖
Thank you!
Me gustó el video ❤
😄
I made a game with wasd controls, and now i want to make a mobile version of it, though its gonna take forever to remake everything for mobile, so is their an easy way to change it in the same script maybe?
Edit: I forgot to mention that I dont want joysticks, instead id like arrow buttons. is there a way for a button to receive the same input message as a keyboard arrow? like make the button on screen behave like the one on the keyboard?
The input system is designed to be easy to adapt for different consoles. What you can do is have 4 on screen buttons and each one overrides the control that you currently have bound, for example have one button override the up arrow key or W. It should “act” as those values and you shouldn’t need to change much in the code. Let me know if that helps!
@@samyam yeah thats what I want, but I cant find a way to make it real, u have a tutorial on ur channel that might help with UI and buttons n stuff?
Yeah I have some videos on using the UI with the new system, although I don’t have a dedicated video of on screen buttons
Enable UI with the new system ua-cam.com/video/TBcfhJoCVQo/v-deo.html
Controller and Keyboard Menu Navigation
ua-cam.com/video/Hn804Wgr3KE/v-deo.html
Joystick ua-cam.com/video/zd75Jq37R60/v-deo.html
^ Concept should be similar as in the joystick video but use on screen button instead
@@samyam aight thx for ur time, ill check em all out.
Is there a tutorial of yours where you explain step by step how to code the character script instead just to copy from the documentation? thanks for the tutorial. :D
Hi Sam, after implementing the UI and hit play, I can't drag the image around and move the joy stick. Any idea what's happening?
see earlier comment: I noticed that the UI image wasn't moving around for me (see about 1:30 in the video). I fixed this problem by going into my EventSystem game object and changing from "Stand Alone Input Module" to the new InputSystemUIInputModule. If anyone else has a similar problem you may have a similar issue.
i don't have any unity registry or input system in the package manager in Unity 2019.3.11f1 (64-bit) version
Awesome, thanks!
great video! is there a tutorial for how to make the camera just be controlled by swiping on the screen (like minecraft does it)? thanks so much
edit: forgot to mention first person as well
Yeah! The video is a little older but I did a third person video of that
ua-cam.com/video/YV5KOZHsIz4/v-deo.html
(Basically as a hack you can make the joystick invisible and place it over the are you want the player to swipe then pipe that input to your camera look)
I have a separate first person controller video (without joystick)
ua-cam.com/video/5n_hmqHdijM/v-deo.html
And since then I found an easier way to replace the cinemachine old input system values (cinemachine input provider)
ua-cam.com/video/we4CGmkPQ6Q/v-deo.html
Ah I also have a swiping video that you can use instead of the joystick hack, and change it to your needs:
ua-cam.com/video/XUx_QlJpd0M/v-deo.html
@@samyam thank you for these however i am not having any luck. i wont go into why it doesnt work for me as its a somewhat long explaination, but to simplify it, it feels very unresponsive. rotating the camera based on the finger's position when the screen is first pressed compared to its current position would make it feel much better i think. however im not really sure how to go about doing that using the new input system, as i dont know how to get a constantly updating vector2 of the current position of the screen press
When you start pressing, you can start a coroutine that checks every frame for the position and updates the camera accordingly:
// pseudo code (sry on phone kinda messy)
Coroutine c;
OnStartTouch() {
c = StartCoroutine(UpdateTouch)
}
OnEndTouch() {
StopCoroutine(c)
}
IENumerator UpdateTouch() {
while (true) { // or instead you can check if the finger is pressed and not have to do a StopCoroutine call
vec2 v = get finger position
camera.transform.position or rotation = finger position
yield return null;
}
}
@@samyam this worked great, but i do have a new problem. i can now only interact with my other buttons with right click. this might not be an issue as it could just be simulating a different finger, however i dont have the ability to export it to my phone right now to test. something that is definitely an issue is that when i interact with right click it still rotates the camera. how can i make the camera only rotate when being pressed off of the buttons? thank you for your help so far
awesome, to the point
I watched a few videos from you about movement and input. pretty good.
but what about a video where you actually MOVE something?
Couldn't find anyone.
Thanks! I have a playlist on character controllers here
Unity Character Controllers
ua-cam.com/play/PLKUARkaoYQT2XKPI7Aj9NVOxcI5OlnuK8.html
Great tutorial
Thanks!!
question how can i change the right joystick to look around to just use the right side of the screen so i can put another button there for lke jump or slide etc.
(also how can i make the movement have exceleration? so the more you move character the faster it gets)
Hello pls help . No video is helping in my game no joystick works
I did a right click and drag on the soft roll, now if I click Play the position clock starts but my ti cursor does not move and I cant
Thank you !
Hi samyam, i got a problem with touch input. i followed your procedure and its working on some devices but not on all. it gives laggy output. Actually, its not working on my own phone but on other extra android devices that i have it is working fine. I want to know what could be the reason for this laggy output movement on using an on-screen stick. I have checked my phone's performance and touch inputs but nothing seems to be working. PLEASE HELP !!!!!!!!!!!!
this is because of unity remote 5... im banging my heads against the wall too.
apparently using Input System version 1.1.0-preview.3 works for some cases...
just change the version number in ur manifest.json file
I have the same issue! Did you find any solution?
I had an issue with laggy joystick too, not sure if yours is same but I fixed it by moving my controls script at gameobject inspector above the rigidbody/collider.
So probably the issue is because of priority of components, if physics components are first, the engine is doing physics calculations THEN doing what you have in your controls script, and it's the reason why it's laggy.
I've a problem with the joystick..... Whenever I move a joystick (little bit) the speed of the player is slow but when I move joystick farther the speed is normal...I'm using 2D rootMotion.... Can you please help....
That's normal, the joystick will give you smaller values if it's closer to the center. You can normalize the value manually or add a Normalize Processor to your action
ua-cam.com/video/17VqOh3_zxU/v-deo.html
@@samyam Thank you very much.
I follow the video but I don't necassarily get the implementation into code. I am trying to use a joystick that essientially if held down (pass through i'm assuiming) triggers one function, if held up triggers another function... etc.
Great video! I have a question though. How can I enable input detection just tapping anywhere on the screen but not only Canvas left-pad that we did in the video?
Do you mean from anywhere in the screen move the joystick? You can make an invisible image covering the whole screen and attach the on screen joystick to it as a workaround, and then have a joystick image mimic the movement you are making on the invisible image for visual feedback. Is that what you mean?
@@samyam That's exactly what I meant. I made image with alpha 0 full-sized, and its working like a charm, thanks a bunch! I should have thought about that :D
Nice!! Yeah it’s a bit “hacky” but it works!
@@mehmetakyuz5290 Hello, can you give a little bit detail how to achieve that?
everything is on a video that i have no idea where.... thanks
Great, thanks!
I have a problem when using this. Even when I'm not touching the joystick image, but when my click/touch is in the proximity, the joystick gets selected and moves. This interferes with other buttons that are near by.
not quite working for me, the joystick doesn't move after adding the on-screen stick component
I dont get the on screen component help me
Me: creating joystick from scratch
samyam: ...so all you need to do is add On-Screen Stick component
after all this time ...
😂
Dear Samyam,
Can you help me make floating joystick on mobile with the Unity Starter Assets FPS controller, I cannot get it working, I have been on this a looooooong time can you help me?
i made the controls for pc and it does not work on android, what you told did not work,still thanks
Can you make a video about mobile first person controller, I saw the one for pc but for mobile is not there
I'm new to unity and was trying the to create an on-screen joystick using this tutorial. But I'm currently running to an issue where I cannot move the on-screen stick when testing on android. The stick can move when testing on windows. What should I check/setup in order to fix this?
Edit: Tested the Input System samples (on screen controls and touch samples) but still experiencing the same issue.
Using Input System v1.0.2 on Unity Editor 2020.3.11f1
Thanks
Try using Input System version 1.1.0-preview.3 (in the package manager, in the settings up at top, click advanced project settings and there will be an option to enable preview packages)
forum.unity.com/threads/on-screen-joystick-sticking-on-android.1005158/
@@samyam will try this, thanks
After several testing, it seems that the problem is with the unity remote 5 and not with the input system as the controls work after building as an apk
@@geroncrisjulius Confirmed - It worked on APK file
Thanks a lot! how would i deal with if our camera is top right or smth.
*tell me one thing maam, is this available for commercial purpose ?*
Yes it’s fine in any games or projects. but if you are taking the code from my patreon and distributing it as your own without any substancial changes then that’s not allowed.
Nice. But I have one question. Does using old way ( get inputs from update()) gives less frame rate ?
On the back end the input system has to run on every frame anyways to detect input so I wouldn’t think there would be much of a frame rate difference. You can run a quick profiler test using simple input to test it.
float targetAngle = Mathf.Atan2(input.x, input.y) * Mathf.Rad2Deg + cameraTransform..... whats writing after miss ?
same problem haha
Good one Sam ;)
Thanks!
Thanks!
Can you make tutorial about joysticks with out using input system for 3rd person movement
Hmm that’s not currently in my plans, I’m using the new system for most of my videos since that’s what unity will eventually one day switch to. But my videos shouldn’t be too hard to adapt to using the old system. Here is my third person video
ua-cam.com/video/ImuCx_XVaEQ/v-deo.html
joystick not showing in screen it only shows in game and not working
And what about the speed sensitivy?
why my Ui buttons not working when i press play
Great video! Helped a lot. Thanks for it and keep going
Thanks!!
I have 4 errors while doing this, also I want to script the joystick, not by an asset.
Well, what errors do you have? If you don’t want to use the On Screen Joystick that’s provided you can make your own. Or use the one Unity made in their new Starter Assets
ua-cam.com/video/CD0FlqllfIE/v-deo.html
@@samyam Thanks! Ive also discovered the ploblem, slince I've change the build settings to android, some of the computer controls where still there. Thats probably why.
Hi, this video is great and helped out a lot. But I was wondering if there's a way to make the joystick more customizable. Before I switched to the new input actions I downloaded a free joystick asset pack and the controls on those feel better because of possibly lower dead zone and the fact that the center of the joystick can move according the finger's position.
Yeah you can change the On Screen Joystick script to fit your needs (or make your own joystick and follow their example). The new starter assets from unity also has a Virtual Joystick script with different functionality
ua-cam.com/video/CD0FlqllfIE/v-deo.html
wow Thanks!
Can you move the camera and the joystick at the same time?
Is this joystick counts only parameters from - 1 to 1, or it reads like 0.5f or 0.6f (Please sorry for my English)
Counts from -1 to 1 and the numbers in between
Hello, thank you for this nice video, but i have a question. Houw to make this controller for 2D platformer games using virtual buttons? I can't to finde some tutorial about it, because many tuts are with joystick. If it possible to make some video, would be great. Or maybe just help me.
Because on Unity Editor virtual buttons works good, but when i make Build for testing on Mobile, there are some bugs (player do not move or moving with lottle steps after many tap on buttons)... Maybe some bad Interactions setting... I don't know... I stuck with this 🤷🏻
Great tutorial but how to move camera around without using joystick?
I have a third person controller video here without joystick:
ua-cam.com/video/ImuCx_XVaEQ/v-deo.html
Hi!, I'm using a game pad, and I have an issue. Maybe you can help :). My character has a blend-tree to manage the IDLE and move animations, and when I let the analog stick go back quickly to the center, the blend transition from run to IDLE go too fast. When I use keyboard this transition is OK. Any idea?.
Try printing out the values from the analog stick to see what values are getting registered (or use the input debugger ua-cam.com/video/ICh1ZEaVUjc/v-deo.html)
my project cannot support multi-touch. The 2nd touch affects the left stick.
Try upgrading the Input System to the latest package
How do you read the playerInput values from the PlayerController script? What is playerInput an instance of? The component is called "Player Input" but I can't find anything like that when I try to reference it in code
You have to include the InputSystem namespace
using UnityEngine.InputSystem;
Then you can do:
PlayerInput playerInput = GetComponent();
InputAction moveAction = playerInput.actions["Move"];
moveAction.ReadValue();
as an example
make sure your code is using UnityEngine.InputSystem;
How do I undo everything because now all my code for player movements using the keyboard controls are not working.
That shouldn’t impact your keyboard input if you added another binding under your Movement action. But you can just delete the gameobject you made with the Stick
Amazing! Very helpful!
Thanks!
thx
is this working for 2d projects?
Yes should work :) You can customize it to your use case as well
@@samyam OK cool, thanks 😎👍
Heya Samyam! Do you find you have issues with multitouch? I find I can press one whilst using the other... :/
Yeah I’ve heard some people haven’t issues with that. Try setting in the Event System Module Pointer Behaviour to All Pointers As Is
@@samyam thanks! Yeah I tried this! All of those 3 settings! I'll dig more. I was wondering if there were overriding settings at project level too maybe.
So what happens when you use the second one exactly? Or you just can’t use the second one
@@samyam it's like I can tap the jump button (a button instead of right stick) and it doesn't register unless I'm not using the left stick. It feels like the focus changes a bit like switching between inputs . But this is all on mobile
Huh that is strange. Probably won’t work but try setting to passthrough for your action types you are using.