Viewed so many tutorials and only this one worked. Thnx Man Great Stuff
@georgeoutters56576 жыл бұрын
Awesome video, exactly what I needed for my small project!
@ArikCool3 жыл бұрын
Please Help! How can you make the character not glide? i want it to move while pressing and immediately stop while not moving
@ast4ay4792 жыл бұрын
Increase the drag on the rigidbody i havnt used 2d but with 3d thats what i did in 3d
@matteoxt24mt4 жыл бұрын
Where is the part when u connect the code to the button?
@amit_patel1686 жыл бұрын
Nice trick dude... This helped me🙂
@jbsoftware37206 жыл бұрын
Thanks, i will remember to make a donation after.
@moroniafrifa6146 жыл бұрын
Thanks a lot for this. Saved me from a headache
@AsToldByWaldo6 жыл бұрын
Moroni Afrifa cheers
@TheRitesh414 жыл бұрын
AAAH life saver video thanks man i was trying to figure that out , somehow i couldnot figure out the simple logic of dividing by screen width to manage the multi touch . THANKS AGAIN.
@siuchoi76555 жыл бұрын
Thanks a lot! That is exactly what I need for my game! Great tutorial!
@CanCaglaAndMina5 жыл бұрын
Thank you so much. I was strugling with this problem for a week, but your vid helped, so thanks!!!
@ics_de6 жыл бұрын
Why do you have such a low subscribers number? Your explanations are pretty good and clear! I hope your channel grows, because you deserve it :)
@AsToldByWaldo6 жыл бұрын
Thanks for the kind words! I've only been doing this for a couple of months. Things will hopefully grow at an exponential rate, but please share and spread the word to help me out along the way. :)
@ics_de6 жыл бұрын
As Told By Waldo That's what I'll do!
@pedidosnica2 жыл бұрын
Thanks, I was seeking this.
@hyperlaserstudios78936 жыл бұрын
Can you please make another one of these, but for 3D?
@SamGaming3605 жыл бұрын
Did you ever find out how?
@morenunomath95625 жыл бұрын
@@RichOrignisl I am starting to study c#, and I did what you recommended and it worked but the character is very slow, I've already I increased the speed of the character and it still slow, can you help me?
@laele27265 жыл бұрын
@@morenunomath9562 try to change the physics properties from your character game object
@charlesferry94654 жыл бұрын
@@RichOrignisl should I change Vector2 to Vector3??
@NewtonPL4 жыл бұрын
you know you can edit the script?
@christianthompson18396 жыл бұрын
So my question is how do we implement both keyboard controls and touch controls for people with touchscreen computers? I was thinking maybe you could use *else if* but I'm not sure
@wchannel016 жыл бұрын
I tried to use this for a 3D game which uses "a" and "d" to move left and right but could not successfully replace the keys with the mobile input. This is what I have: void FixedUpdate() { rb.AddForce(0, 0, forwardForce * Time.deltaTime); if(Input.GetKey("d")) { rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange); } if (Input.GetKey("a")) { rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange); } }
@DionFernandes34 жыл бұрын
Here's the code for 3D using System.Collections; using System.Collections.Generic; using UnityEngine; public class Movement : MonoBehaviour { //variables public float moveSpeed = 300; public GameObject character; private Rigidbody characterBody; private float ScreenWidth; // Use this for initialization void Start() { ScreenWidth = Screen.width; characterBody = character.GetComponent(); } // Update is called once per frame void Update() { int i = 0; //loop over every touch found while (i < Input.touchCount) { if (Input.GetTouch(i).position.x > ScreenWidth / 2) { //move right RunCharacter(1.0f); } if (Input.GetTouch(i).position.x < ScreenWidth / 2) { //move left RunCharacter(-1.0f); } ++i; } } void FixedUpdate() { #if UNITY_EDITOR RunCharacter(Input.GetAxis("Horizontal")); #endif } private void RunCharacter(float horizontalInput) { //move player characterBody.AddForce(new Vector2(horizontalInput * moveSpeed * Time.deltaTime, 0)); } }
@MaxAttack784 жыл бұрын
SHADY thank you so much for the help! I got the coding down now would I follow the rest of the steps in the vid or no
@DionFernandes34 жыл бұрын
@@MaxAttack78 Yes you can
@MaxAttack784 жыл бұрын
SHADY ok thanks so much you quite literally saved my game 😂
@zKingRox4 жыл бұрын
@@MaxAttack78 did it work for you when you played the game on phone
@giorgiphareshishvili4 жыл бұрын
Thanks bro, you really helped me, when i release my game ill post the link here so people can rate it
@NewtonPL4 жыл бұрын
so that was a lie
@riodsh61866 жыл бұрын
I love you for this TuT Sir this helped me a lot !
@claudiu78975 жыл бұрын
how do i flip the character
@hrva00734 жыл бұрын
Can you make sprite flip left and right with this script?
@gidothings82564 жыл бұрын
Hrva 007 yes, with an animator
@memefish97723 жыл бұрын
still working with the 2021.1 version. thanks, you get a new subscriber :)
@diazcastro73313 жыл бұрын
didnt work for me
@leanderpereira52576 жыл бұрын
Can u make a similar video for moving a character up and down
@guilhermelopes25875 жыл бұрын
@@lachzloyt9189 What?
@NewtonPL4 жыл бұрын
just change the script
@JonBaldockInkDrawings3 жыл бұрын
i tried changing thescript for up and down, doesn't work
@user-dd5gk9qj9g6 жыл бұрын
so was the ui buttons solely for aesthetic reasons, for the highlighting and the "L" and "R" text??
@AsToldByWaldo6 жыл бұрын
Sam Smith yes
@cjthomp20056 жыл бұрын
waldo, theres no point in doing that if the buttons dont do anything.
@shoaibmujawar13756 жыл бұрын
That's exactly what I needed. Thanks a lot...
@Asherrr5 жыл бұрын
Absolutely fantastic video, you really "touched" on exactly what I needed! XD
@hddbvdcx2 жыл бұрын
Hey This is supercool! You helped me a lot.
@FatherPhi5 жыл бұрын
Great idea man, awesome content
@Bartosz256 жыл бұрын
Great tutorial, thank you.
@djalaljay3 жыл бұрын
You saved my Game thank you
@TheUnOrdinaryFreak6 жыл бұрын
3:18 when you click on the buttons it highlights but in my project that is in 3D when i hit the button it doesn't highlight. Is there any problem?
@pressstart68646 жыл бұрын
Make sure you have an event system added to your scene. They're usually added automatically when you add a canvas, but if you don't have it, that could be the reason for the problem. 3D shouldn't be a problem.
@TheUnOrdinaryFreak6 жыл бұрын
@@pressstart6864 please if you could make a 3D tutorial for the same it would help a lot of people !
@leezakdev5 жыл бұрын
Just add a new canvas and it should fix your problem
@saudahmad14296 жыл бұрын
thank you for this tutorial.
@ahsanarifeen78273 жыл бұрын
Hey Waldo, I wanted to ask if the touch input works in the editor, or will we have to build the project first? I subscribed :)
@Slinkingcheeze5 жыл бұрын
Hi, great video dude! I have a question though, is there a way to make the character instantly stop moving as soon as i lift my finger from the screen? So the character doesn't start gliding in that direction?
@2014-b4o4 жыл бұрын
yes by using transform.Translate instead of AddForce
@atch3003 жыл бұрын
@@2014-b4o hey thanks. Works like a charm
@SamGaming3605 жыл бұрын
Anybody know how to make this in 3d games?
@SamGaming3605 жыл бұрын
@@pavinpariyar1883 ok thanks
@carnage69685 жыл бұрын
@@pavinpariyar1883 Could you copy/paste it in a comment ,please? I don't know where I messed up x)
@aryanjumani45245 жыл бұрын
@@pavinpariyar1883 also you need three values in the vector3, X, Y, and Z and not just X and Y values
@japrolol5 жыл бұрын
Is it possible for me to make it that if i stop holding my character pauses, please answers!
@BillyMan5 жыл бұрын
Thank you, Sir. You helped me
@VoiD900092 жыл бұрын
Ui buttons work in editor but they do not work in android after building it
@babatelli87667 жыл бұрын
nice tutorial mate, really helped me out. would be nice if u could do a series on how to build a simple android game with unity. maybe a endless runner or something.
@AsToldByWaldo7 жыл бұрын
Thanks. I am currently working on a series. Stay tuned!
@babatelli87667 жыл бұрын
any date u gonna release the first episode?
@AsToldByWaldo7 жыл бұрын
I'm recording the first episode this week so most likely next week. Since I'm going to cover a lot of topics from start to finish over a series of videos, it might be a few weeks before I cover anything substantial. Make sure to subscribe for updates on when this will be released.
@AsToldByWaldo6 жыл бұрын
A little earlier than planned. Episode 1 is done. kzbin.info/www/bejne/nomxioCjbcxgh7M
@letsplaynay99364 жыл бұрын
What if its isometric? I have diaganol movements aswell
@aiman93064 жыл бұрын
code for 3D pls?
@AdirBenYair975 жыл бұрын
Thanks man this really helped!
@ebbevandijk80695 жыл бұрын
You’re the real mvp
@2420-y2o6 жыл бұрын
Thank you. Splendid.
@latikerostv15566 жыл бұрын
Excellent tutorial! I've done everything and made my character move from left to right. May I ask, how to move a character from top to bottom? Will give make a youtube tutorial for it?
@AsToldByWaldo6 жыл бұрын
It's rather simple actually. Just change a few things in the code to use the ScreenHeight, and Y axis. Here is what the code would be modified (didn't test it, but it should work fine): dotnetfiddle.net/kMPyQg
@ondrejbenes22976 жыл бұрын
Thank you for this tutorial. I have just started developing simple games, for Android mainly, and I am still getting into it but I have so many ideas. I needed this bit of code for one of my game and could not find a proper tutorial or explanation that would fit my needs. Your video is nice and simple and code well presented, good job and THANK YOU. I leave like and subscribe, hope that helps.
@AsToldByWaldo6 жыл бұрын
Ondřej Beneš I appreciate your support
@maliktot71823 жыл бұрын
What i have to do to make my character move like to the bottomleft or bottomright?
@umuttarlan55414 жыл бұрын
I tried this codes with "transform.turnaround" butit dosent work. Do you know how can ı make this. If you answer you will help a lot.
@raydartt6 жыл бұрын
Thanks for the video. You are right there aren't many videos on touch controls. It works great but I was surprised to find that the tilt also works. I thought you had to use the Accelerometer for that to work. I don't want my player moving except by screen touch. How can i stop that? Thanks
@AsToldByWaldo6 жыл бұрын
There's nothing in the code that should make that happen. You might have something else enabled causing it to do that.
@raydartt6 жыл бұрын
Thanks for your response. I found the problem. I had another script attached to the player that i was using to test the Accelerometer. I remember deleting it but i guess i didn't save my scene before i tried your script. Sorry to bother you with my stupidity.
@martinovlog3 жыл бұрын
But i cant add a pause button now, does anyone know how to solve this?
@brandonisjerimaya62965 жыл бұрын
AMAZING! but.... What alterations to the code are necessary to attach the script to the player instead of the camera?
@ЯрославЗинченко-ц4ш6 жыл бұрын
I don't get it. You're assigning your script to your Main Camera and trying to access the rigidbody of the character, but his rigidbody is set to 'private'. How is it even working?
@dimwood20116 жыл бұрын
I think because he declared it in the Start() function Start() { characterBody = character.GetComponent(); }
@wzykz71394 жыл бұрын
Hey great video! Just wondering how to get character object to stop sliding?
@2014-b4o4 жыл бұрын
by using transform.Translate instead of CharacterBody.AddForce
@Zaine76736 жыл бұрын
Excellent Tutorial brother, thank you. I loved the fact that you don't have to clutter the screen with UI elements for simple move functions on a mobile. I've used parts of this for a 2.5D game I'm working on (hope you don't mind) I'm using rigidbody.velocity to move my character but he seems to slide for a while after i let go of the screen. have to figure that one out. I have a charge jump feature (hold jump for longer to do a higher jump) for PC at the moment. would love to see you do a video on how to do this on a mobile maybe using double tap? thanks,
@AsToldByWaldo6 жыл бұрын
Appreciate the feedback! Feel free to use everything in this video, that's why I made it. :) Rigidbody.velocity is still the best way to move a character, but adjust the gravity and linear drag on the character to fix the sliding. You'll also have to adjust the moveSpeed variable along with it since increasing these will make him move slower. It takes a while to find the right setting that works best for your game. I recently had this problem with a new game I am working on, but after a few minutes of tinkering I was able to get it right. Down the road I'll be making more videos, but for mobile jump, what I've done in the past is use the first half of the screen for Left/Right controls and then the second half touch for jump. That can easily be done using the code in this video, but instead of dividing screen width / 2, change it to / 4 (quarter of the screen). Cheers!
@jonyp22664 жыл бұрын
my character is disappearing with this script when i add it to main camera
@N1thium5 жыл бұрын
Hey Waldo nice video! There is a way to make it without make the character be a game object of the camera? thanks!
@greeng4483 жыл бұрын
Amazing
@79rooky5 жыл бұрын
With the touch controls, how do you flip the sprite when it goes left and right? I tried other tutorials but they're all for keys and not touch and all their code doesn't work
@ajaysrinivas38194 жыл бұрын
THANKS A BUNCH MAN😘🙌
@arvindersingh65934 жыл бұрын
Amazing, Thank you
@photoshopsuraj6 жыл бұрын
How to make this in 3D its not working
@AsToldByWaldo6 жыл бұрын
Should work in 2D or 3D
@christianthompson18396 жыл бұрын
Yup
@SamGaming3605 жыл бұрын
@@AsToldByWaldo I try to assign the 2drigidbody but it doesn't work on 3d
@markushoffmann34942 жыл бұрын
You just Gained a Sub, Like and Comment really good vid btw. awesome 🤩
@lordvir-clashofclansandmor54366 жыл бұрын
Debug.Log ("i am new to programming and still learning c#.. Can you help with a script for the same left-right functions but in 3d? please?")
@AsToldByWaldo6 жыл бұрын
Working on it
@lordvir-clashofclansandmor54366 жыл бұрын
As Told By Waldo okk!! I subbed you!
@lordvir-clashofclansandmor54366 жыл бұрын
As Told By Waldo is it ready bro??
@lordvir-clashofclansandmor54366 жыл бұрын
why dont u tell?? is it ready??? please help me
@lordvir-clashofclansandmor54366 жыл бұрын
tell is it ready? it dosnt take 2 days for a script to be ready!
@MobileGames-GamePlays6 жыл бұрын
Hello. Very good video! Thnks! But :( My script does not have a "RunCharacter" style function. Instead of using "panelim.transform.Rotate (0, 0, turnSpeed * Time.deltaTime);" I use a code like. What should I write in fixedUpdate to be able to experiment in the Unity Editor? Can you help me?
@AsToldByWaldo6 жыл бұрын
Choco Like instead of using run character I would use that line. For left side of the screen just negate turnspeed like this -turnSpeed. If you send me an email with your script I can show you what I mean.
@MobileGames-GamePlays6 жыл бұрын
My script is below. (I could not find your mail address) using UnityEngine; public class movement : MonoBehaviour { public float turnSpeed = 15f; public GameObject panelim; private float ScreenWidth; void Start () { ScreenWidth = Screen.width; } void Update () { int i = 0; while (i < Input.touchCount) { if (Input.GetTouch(i).position.x > ScreenWidth / 2) { //right panelim.transform.Rotate(0, 0, - turnSpeed * Time.deltaTime); } if(Input.GetTouch(i).position.x < ScreenWidth / 2) { //left panelim.transform.Rotate(0, 0, turnSpeed * Time.deltaTime); } ++i; } } private void FixedUpdate() { #if UNITY_EDITOR // ????????????? #endif } }
@MobileGames-GamePlays6 жыл бұрын
My email is chocolikegames@gmail.com . Pls help for this. Thnks.
@dnt_dimpsybeast72306 жыл бұрын
@@MobileGames-GamePlays yo bro got the sam problem can u help me? or send me the code plz
@MobileGames-GamePlays6 жыл бұрын
@@dnt_dimpsybeast7230 I haven't found a solution on Unity editor. I added 2 Buttons instead of using the unity editor. I also commanded these buttons to work in update mode. I thought it was a component except for the Button component. That's how I solved my problem. Let me leave the link to my game. I'd appreciate it if you'd give it 5 stars. play.google.com/store/apps/details?id=com.Chocolikegames.space.ball.thiefs.action.adventure.high.speed.ball.casual.best.indie.jump.star.game.games.rotaw.rotate.wars
@varundoshi51363 жыл бұрын
This isnt working for me...cant figure out why
@2014-b4o4 жыл бұрын
when i click on my pause button my player moves cuz of the screen width how can i fix it
@martinovlog3 жыл бұрын
Did you find a solution?
@syympl2573 жыл бұрын
I did everything as you said and did , but it didn't work neither with touch nor with the keyboard , i've spent my entire day watching videos and learning code so that i can move my object just left and right on mobile screen by touch , but still haven't found any success
@nachohernandez93304 жыл бұрын
In a 3D game I should declare a Rigidbody3D instead?
@marcialdavidgamerpineda83744 жыл бұрын
Yep
@reasorr4 жыл бұрын
How can I make it more precise so that the player doesn't slide that hard ?
@2014-b4o4 жыл бұрын
add transform.tanslate instead of CharacterBody.Addforce in the movement or what ever u named ur rigid body
@2014-b4o4 жыл бұрын
and edit the values
@boismd6 жыл бұрын
nice video sir .. can i ask if this can be used to tilting movement so it can move whenever i press left side or right side of screen continually? thx
@knockknockp5 жыл бұрын
Can't you just use for loop in the script instead of that while loop? anyways thanks for helpful vid
@nrgstudios6125 жыл бұрын
I think so. You got the initialization, condition and increment right there.
@HeartThief044 жыл бұрын
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Movement : MonoBehaviour { //variables public float moveSpeed = 300; public GameObject character; private Rigidbody2D characterBody; private float ScreenWidth; // Use this for initialization void Start () { ScreenWidth = Screen.width; characterBody = character.GetComponent(); } // Update is called once per frame void Update () { int i = 0; //loop over every touch found while (i < Input.touchCount) { if (Input.GetTouch (i).position.x > ScreenWidth / 2) { //move right RunCharacter (1.0f); } if (Input.GetTouch (i).position.x < ScreenWidth / 2) { //move left RunCharacter (-1.0f); } ++i; } } void FixedUpdate(){ #if UNITY_EDITOR RunCharacter(Input.GetAxis("Horizontal")); #endif } private void RunCharacter(float horizontalInput){ //move player characterBody.AddForce(new Vector2(horizontalInput * moveSpeed * Time.deltaTime, 0)); } }
@brayliodeus59227 жыл бұрын
nice tutorial, more pls :)
@AsToldByWaldo7 жыл бұрын
Braylio Deus thank you :) more coming soon
@tylersanders69924 жыл бұрын
Just a question this is probably to old but how would I make it without press and hold)
@gamethingstuff4 жыл бұрын
How would you had exceptions to this. Like if you wanted to press a button on screen without it causing player movement aswell?
@gamethingstuff4 жыл бұрын
Never mind solved it :) if(Input.GetTouch(i).position.y > ScreenHeight / 4.5) used that so it would cover the top 4.5/5ths of the screen so the bottom section would not be included so i could buttons in there.
@2014-b4o4 жыл бұрын
@@gamethingstuff it didnt work
@gamethingstuff4 жыл бұрын
@@2014-b4o my script if it helps using System.Collections; using UnityEngine; using UnityEngine.UI; public class PlayerMovement : MonoBehaviour { public Rigidbody rb; public float forwardForce = 6000f; public float sidewaysForce = 30f; private float ScreenWidth; private float ScreenHeight; void Start() { ScreenWidth = Screen.width; ScreenHeight = Screen.height; } void FixedUpdate() { if(rb.position.y < -1f) { FindObjectOfType().EndGame(); } int i = 0; rb.AddForce(0, 0, forwardForce * Time.deltaTime); while(i < Input.touchCount) { if(Input.GetTouch(i).position.y > ScreenHeight / 4.5) if(Input.GetTouch(i).position.x > ScreenWidth / 2) { rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange); } if(Input.GetTouch(i).position.y > ScreenHeight/ 4.5) if(Input.GetTouch(i).position.x < ScreenWidth / 2) { rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange); } ++i; } } }
@2014-b4o4 жыл бұрын
@@gamethingstuff thanks i will read it tomorrow
@2014-b4o4 жыл бұрын
@@gamethingstuff what if i wanted to put buttons in the upper side what is the values for that
@MINECRAFTzerack5 жыл бұрын
Nice tutorial but how can i code it that if I stop pressing the button that the character INSTANTLY stops to move?
@blackjackveteran4 жыл бұрын
did you figure it out dealing with the same problem
@2014-b4o4 жыл бұрын
add transform.tanslate instead of CharacterBody.Addforce in the movement or what ever u named ur rigid body
@2014-b4o4 жыл бұрын
and edit the values
@roemerlin98873 жыл бұрын
@@2014-b4o I don't get it, what do you mean
@ayourabbu5 жыл бұрын
my character move very slowly????
@aryansinha72074 жыл бұрын
for some reason, my UI won't show up in the game screen PLZ HELP
@2014-b4o4 жыл бұрын
have u added them to ur canvas?
@2014-b4o4 жыл бұрын
try adding another canvas too but dont put anything in it and keep ur main canvas
@gamethingstuff4 жыл бұрын
thank you my man
@MINECRAFTzerack5 жыл бұрын
I have the same code like you but i get this error: MissingReferenceException: The object of type 'Rigidbody2D' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.
@ZeoGundam6 жыл бұрын
hey I have a question I hope you can answer for me. So Ive implemented this code where the left side of the screen jumps and the right side of the screen does a dash, but when I dash I also jump as well. Is there anyway that can be fixed? Thank you for reading this and I look forward to your response :)
@AsToldByWaldo6 жыл бұрын
JJWrekinCrew separate your jump code and your dash code. If you email me your source code I can be more specific.
@ZeoGundam6 жыл бұрын
Alrite cool thank you for doing this! What is your email?
@AsToldByWaldo6 жыл бұрын
Please go through my website.
@ZeoGundam6 жыл бұрын
Thanks again for the help! Ive subscribed to your channel and looking forward to your next videos!
@gooty61854 жыл бұрын
excuse can we use unity buttons in mouvement smoothly I mean when I put in the left button the object move to the left smoothly not translate +1 and stopped I mean that have you got an idea about making buttons useful to move in android not this bad method in the video no an other one please
@2014-b4o4 жыл бұрын
maybe u have to add rigid body and force
@poojanarendiran60526 жыл бұрын
can u plz say how did u link those animation with the left and right button? I actually want if I press left button my character needs to jump and if I press right button my character need to fire. plz give me a solution as soon as possible.
@AsToldByWaldo6 жыл бұрын
The buttons we created on the screen were just for visual purposes only. The reason for this is we were not able to do a press and hold function which would work best for moving left and right. Instead we coded a IF touch is on screen, then loop and based on the position we decided whether it was on the left or right of the screen (see source code above). In your case, you would benefit from attaching a function to the UI buttons themselves. That can be done in the UI in the inspector, or through code like so: public Button yourButton; void Start() { Button btn = yourButton.GetComponent(); btn.onClick.AddListener(TaskOnClick); } void TaskOnClick() { Debug.Log("You have clicked the button!"); } docs.unity3d.com/ScriptReference/UI.Button-onClick.html Then create two functions, one to fire and one to jump and apply them to your buttons.
@poojanarendiran60526 жыл бұрын
thanks a lot for the response...ill try and let u know the progress.so kind of u.
@johncarloabad68776 жыл бұрын
but ive already done it. and it doesnt work on my phone ? what will i do for us to play it on mobilephone?
@aimbedarf4 жыл бұрын
Could someone tell me what to change to use the same buttons for up and down?
@2014-b4o4 жыл бұрын
use y instead of x
@KxiiiNG6 жыл бұрын
THANK YOU! I have been up since 10:3Oam and it is now 5pm. You are the ONLY Helpful tutorial for this as simple as it should seem. I have only 1 issue. Are we not using 'on button click' events? I uploaded to mobile and it highlights when I touch, but my Rigidbody doesn't actually move. However, this is still amazing and it put me in the right direction and I like figuring these things out since I'm new.
@philseitig5 жыл бұрын
What do I have to change if I only have 20% buttons left and right? It seems not to be: ... ScreenWidth divided by a higher number
@romeosreadings4 жыл бұрын
Thanks this helped :D
@Sixty969-65 жыл бұрын
Cantt add script i copied the script from you site but it cant Add?????
@Nasser_Moahammed3 жыл бұрын
Thanks a lot man
@manojumaeku4 жыл бұрын
Please advice. How do i move the block along with my finger movement, only when i am touching on it? I do not want to move the block automatically to the position of touch in the screen. I am using unityEngine.Touch.
@gametechy7024 жыл бұрын
You got a sub dude!
@alexgunzz5 жыл бұрын
I’m trying to figure out how to just move my player character left and right. I don’t want two buttons tho. I just want the player to my left and right by movement of my thumb. Like touch and hold, and move left and right (while holding thumb down) to move the player. Can anyone help? Thanks
@coleseph53213 жыл бұрын
I keep getting an index out of bounds error when running my script based on this tutorial, can anybody help?
@asemalkameltechnology68716 жыл бұрын
hi man i want to move my player animation with ui button like walk anim i do it with keyboard key but i cant do it with ui button i real need hellp plz
@surjakantasingh33775 жыл бұрын
You made this looks difficult with your own solitary logic
@anshikatiwari27854 жыл бұрын
You speak like What I am doing with my life Btw nice tutorial
@tonax20084 жыл бұрын
thanks , you save me c:
@robertoiiasistores53093 жыл бұрын
Amazing but I need a tutorial for Vertical like up and down characters
@yoonbin316 жыл бұрын
You r da best bro
@munirajanm43116 жыл бұрын
I have also Copy pasted your Script. Now i can move with arrows. but Still I can not move object by touch the screen. and also you didn't show move with touch.why? Could you please help me?
@AsToldByWaldo6 жыл бұрын
Are you testing touch on mobile device? I show touch in the first 10 seconds of the video. It won't work if you click on the screen with the mouse. For that you need to implement "Input.GetMouseButtonDown(0)". Also make sure you set your project settings to work only with landscape mode. If you open the App in Portrait mode and then rotate to landscape mode, the controls won't be in the right position. Hope that helps.
@munirajanm43116 жыл бұрын
Thank you for your suggestion.
@thoriqanwar58826 жыл бұрын
Are this can used for Vector 3 / 3D object?
@AsToldByWaldo6 жыл бұрын
Yes, if you only want to move left and right. But I assume in a 3D environment, you'd want to be able to move left, right, forward and backwards which would incorporate the X & Z coordinates. You would need to modify the .addForce to use Vector3 and use moveSpeed with add values to each of those coordinates, instead of just the X coordinate, depending on button pressed. Then you would need to create two more buttons for forward and backwards (if on mobile). A joystick might be a better use. Hoping to making a video demonstrating that soon, so make sure to subscribe.
@thoriqanwar58826 жыл бұрын
As Told By Waldo can you create a tutorial like that please ?