Swipe Control with Touch for Menu Level | Unity

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

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

  • @akbar.project
    @akbar.project  2 ปีที่แล้ว +2

    Download Master Project (Unity3D 2018.4.36f)
    sociabuzz.com/akbar_project/p/swipe-menu-control-master-project

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

    I literally positioned each item manually. Content Size Fitter is miracle

  • @enigmagaming4008
    @enigmagaming4008 4 ปีที่แล้ว +5

    I never feel the need to comment on anything...but damn this is a great tutorial!!!

  • @Ryan-cy2jl
    @Ryan-cy2jl 3 ปีที่แล้ว +8

    Very good script, only thing I would change is some optimization to reduce the declaration of variables on update and for loops, like maybe a check or a variable with the current level stored so you aren’t looping through so much. Could save processing power (and battery life for mobile)

  • @минусдваминусодинноль
    @минусдваминусодинноль 4 ปีที่แล้ว

    SUPER HELPFUL! This is like the only video on this topic! gj mate, ur a hero

  • @happyworld4545
    @happyworld4545 4 ปีที่แล้ว +4

    bro you done it very well.... but if you explain the scrip instead of music it will be fantastic and more helpful for us

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

    WoW! Thanks!!
    from Brazil!

  • @ШарШарыч-д4л
    @ШарШарыч-д4л 4 ปีที่แล้ว +3

    Дай бог тебе здоровья, добрый человек)

    • @briooni893
      @briooni893 3 ปีที่แล้ว

      У меня почему то камера возвращается не знаешь почему?

    • @khanlakhno2757
      @khanlakhno2757 3 ปีที่แล้ว

      А вдруг он по нашему не понимает

  • @swaglord2722
    @swaglord2722 5 ปีที่แล้ว +4

    My focus does not change on the 2nd button when i scroll .. help plz

  • @user-mm1pn8sh4p
    @user-mm1pn8sh4p 2 ปีที่แล้ว +1

    the best guide from the best person.

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

    This is 2021 and it's still working :) thanks.

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

    Hello. Amazing tutorial, but I have a question: How can scroll bar be more flexible? So when I touch to left side scroll bar is moving only for one level, but how it to be more flexible (to scroll more than one level)

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

    Anyone know how to start the menu at a specific panel? Like if I want to start on Panel 2 instead of Panel 1??

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

    How do you implement this vertically. It completely broke when I tried to do it.

  • @wisdomkhan
    @wisdomkhan 3 ปีที่แล้ว

    Exactly what i was looking for mate. TYVVM.

  • @sagar-patel404
    @sagar-patel404 3 ปีที่แล้ว +1

    It's work on android ??

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

    this tutorial is gold, thanks.

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

    Excelente tutorial, muchas gracias, saludos desde Colombia

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

    Hey, thank you for the tutorial. May I know how to add sound in between each button, while swiping?

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

    I want selected level to be centered in the screen but I couldn't. How can I do that?

  • @IamBlue.
    @IamBlue. 3 ปีที่แล้ว +1

    How can I controll this with buttons?
    one should move it to the next left the other to the next right pls help

  • @Lobster-xg7se
    @Lobster-xg7se 3 หลายเดือนก่อน

    The best, thank you, you helped me a lot.

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

    Thank you for this video, it saves me a lot! If I change the horizontal scrolling to vertical, everything seems off... Can anyone please give me some guidance or resource to refer? Much appreciated.

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

    the tut was amazing, thx dude

  • @talha5930
    @talha5930 3 ปีที่แล้ว

    Jan e jigar tum tu cha gye🥰

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

    Love this -- thanks a ton! BUT... :) ... the update loop is really heavy, constantly updating the UI even when it's not necessary (=nothing is touched/scrolled etc). I'm trying to optimize it (unsuccessful to this point), any idea would be appreciated!

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

      A bit late, but I got it working with OnEndDrag function (the script needs to be attached to the ScrollView) and using DOTween to animate the movement once the user stopped moving the scrollbar. I can maybe post the code somewhere if you want (I also added the possibility to click the buttons directly to move there)

    • @ozgurakn782
      @ozgurakn782 2 ปีที่แล้ว

      @@Adriankaroshi Please do post the code

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

      @@Adriankaroshi hi, will appreciate if you do post the code :)

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

      using UnityEngine;
      using UnityEngine.EventSystems;
      using DG.Tweening;
      using UnityEngine.UI;
      public class SwipeControl : MonoBehaviour, IEndDragHandler
      {
      [SerializeField] private Scrollbar scrollbar;
      [SerializeField] private Transform content;
      private float[] pos;
      private float distance;
      void Start()
      {
      pos = new float[content.childCount];
      distance = 1f / (pos.Length - 1f);
      for (int i = 0; i < pos.Length; i++)
      {
      pos[i] = distance * i;
      }
      scrollbar.value = 0.5f;
      }
      // Implementing IEndDragHandler interface
      public void OnEndDrag(PointerEventData eventData)
      {
      float nearestPos = FindNearestPosition();
      Debug.Log(nearestPos);
      scrollbar.value = nearestPos;
      AnimateToNearest(nearestPos);
      }
      float FindNearestPosition()
      {
      float nearest = pos[0];
      float distanceToNearest = Mathf.Abs(scrollbar.value - pos[0]);
      for (int i = 1; i < pos.Length; i++)
      {
      float distanceToCurrent = Mathf.Abs(scrollbar.value - pos[i]);
      if (distanceToCurrent < distanceToNearest)
      {
      nearest = pos[i];
      distanceToNearest = distanceToCurrent;
      }
      }
      return nearest;
      }
      void AnimateToNearest(float targetPos)
      {
      int index = pos.Length - 1 - System.Array.IndexOf(pos, targetPos);
      for (int i = 0; i < content.childCount; i++)
      {
      Transform child = content.GetChild(i);
      float scale = i == index ? 1f : 0.8f;
      child.DOScale(new Vector2(scale, scale), 0.3f);
      }
      }
      }
      Script needs to be at scrollView object.

  • @Francisco-gq5nb
    @Francisco-gq5nb 3 ปีที่แล้ว

    Good Video, I used to load weapons that are equipped

  • @GGG-hh5jo
    @GGG-hh5jo 3 ปีที่แล้ว

    Still possible to full screen the level 1 level 2?
    Image?

  • @MusicsforRelaxation
    @MusicsforRelaxation 3 ปีที่แล้ว

    Very nice worke my friend. I can say you Thanks for this is working. I'm Real learnin new menu with scroll))))

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

    Thanks for useful video.

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

    I am getting this error CS1061: 'float[]' does not contain a definition for 'length' and no accessible extension method 'length' accepting a first argument of type 'float[]' could be found (are you missing a using directive or an assembly reference?)

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

    excelent post.

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

    this works with AR? Incredible video!

  • @gillesvismara5228
    @gillesvismara5228 3 ปีที่แล้ว

    very usefull, percise and effective

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

    Guys i have an issue when i apply the script my sprites becomes invisible i want to put a sprite in those buttons for levels
    EDIT: this tutorial works for world space camera canvas but i want to work with screenoverlayspace
    EDIT2: i FIXED IT BY SETTING ORDER LAYER AS 999

    • @akbar.project
      @akbar.project  4 ปีที่แล้ว

      Use image, not spriterenderer

    • @muhammadtalhaali2541
      @muhammadtalhaali2541 4 ปีที่แล้ว

      @@akbar.project bro can you tell me how to make the level pop like if i know ive won certain level how to start this menu screen from that position for instance if i won level 1 how to move the Content gameobject through script ?

    • @ko.vurado
      @ko.vurado 3 ปีที่แล้ว

      Hi, I understand that a lot of time has passed since your comment, but could you tell me where you set this value (order in l. 999)

    • @ghiancarlostan8730
      @ghiancarlostan8730 2 ปีที่แล้ว

      @@ko.vurado i know its a late reply , try adding a sorting layer in your gameobject or adding a child canvas in your main canvas and tweak the sorting order

  • @MasoodOfficial
    @MasoodOfficial 3 ปีที่แล้ว

    How to make it that when clicked zoom in and focus on that button?

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

    I am using this for my shop, is there a way to fill the swipe menu using scriptable objects?

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

    Thanks for tutorial it really help me!!

  • @jeremiahboac6138
    @jeremiahboac6138 3 ปีที่แล้ว

    is it applicable for mobile?

  • @suchizgames4748
    @suchizgames4748 3 ปีที่แล้ว

    Do you know if it is possible to make it loop (endless) ?

  • @isox2816
    @isox2816 3 ปีที่แล้ว

    scrolling up and down doesn't work can you help please
    Scroll bar Always set active false.
    I can swipe menu.But it comes back originial position.

  • @catsebvincenicgagnon3460
    @catsebvincenicgagnon3460 4 ปีที่แล้ว

    You’ve got a like and a new sub!
    Thanks for this tutorial!

  • @366khan
    @366khan 3 ปีที่แล้ว +1

    Very useful tutorial thanks!

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

    hi bro , can you make a tutorial like this but for vertical layout?

  • @vapovag597
    @vapovag597 2 ปีที่แล้ว

    Really clever. Well done 👍

  • @VikramadityaGaikwad
    @VikramadityaGaikwad 3 ปีที่แล้ว

    will it work on android? by swiping?

  • @mauricioalbarracin
    @mauricioalbarracin 5 ปีที่แล้ว

    Hi Akbar
    I would like to know how I can put buttons on the sides? () to move the items when clicking, thanks

    • @akbar.project
      @akbar.project  5 ปีที่แล้ว +1

      th-cam.com/video/eQPmFnREBL4/w-d-xo.html

    • @mauricioalbarracin
      @mauricioalbarracin 5 ปีที่แล้ว

      ​@@akbar.project Gracias, gan

  • @hamzanabli4449
    @hamzanabli4449 3 ปีที่แล้ว

    can anyone explain the distance variable why is it created what does it represent ?

  • @noumanamjad3114
    @noumanamjad3114 3 ปีที่แล้ว

    how we can move the same thing using left / right button .

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

    Thanks for the great tutorial!

  • @afterEffects_0
    @afterEffects_0 2 ปีที่แล้ว

    best tutorial ever

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

    when i click play button, my button images are dissapear. why?

  • @shadowlander468
    @shadowlander468 3 ปีที่แล้ว

    Mouse wheel scroll not working. How to fix it?

  • @joeyllorca502
    @joeyllorca502 4 ปีที่แล้ว

    why this isn't working on my menu?? the reason is float does not contain a definition of length?.

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

    what if i want to make it vertical? can you help me?

  • @eldadmarante8820
    @eldadmarante8820 4 ปีที่แล้ว

    sangat membantu. mantap. thankyou

  • @sunflowerfyp3873
    @sunflowerfyp3873 4 ปีที่แล้ว

    thank you so much, it's super beneficial and it's working 😍👍🏻👍🏻👍🏻👍🏻

  • @ScaryMonday
    @ScaryMonday 5 ปีที่แล้ว

    Alhamdulilah nemu juga maksih mas

  • @ronaldlee320
    @ronaldlee320 3 ปีที่แล้ว

    nice!! i have a question, if i want the unselected level will reduce a little bit alpha, how to script that?? thanks

    • @MuttleyGames
      @MuttleyGames 2 ปีที่แล้ว

      Set the selected position child and create a new color for it and apply it. Don't forget to make the main one full color again.
      In second to last if.
      transform.GetChild(i).GetComponent().color = new Color(transform.GetChild(i).GetComponent().color.r, transform.GetChild(i).GetComponent().color.g, transform.GetChild(i).GetComponent().color.b, 1f);
      In last if.
      transform.GetChild(a).GetComponent().color = new Color(transform.GetChild(a).GetComponent().color.r, transform.GetChild(a).GetComponent().color.g, transform.GetChild(a).GetComponent().color.b, 0.5f);

  • @RestaYete
    @RestaYete 2 ปีที่แล้ว

    The type or namespace name 'Scrollbar' could not be found (are you missing a using directive or an assembly reference?)

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

      uour script is error, instead of use 'Scrollbar', change it to 'scrollbar'. Variable is case-sensitive.

  • @Cookiemantv
    @Cookiemantv 2 ปีที่แล้ว

    any tutorial in bolt?

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

    i id like scrool with mouse scrool well as i can doing?

  • @firerun8599
    @firerun8599 4 ปีที่แล้ว +4

    without unnecessary chatter, in detail, and with good Mouzon, thanks for the lesson!
    Greetings from Russia ^ _ ^

  • @10aaronlove
    @10aaronlove 3 ปีที่แล้ว

    how would you make this work in 3D?

  • @weamghaffar8651
    @weamghaffar8651 3 ปีที่แล้ว

    if i add images instead of buttons, how can i write the code?

  • @cornchowder_channel
    @cornchowder_channel 4 ปีที่แล้ว

    Great video! Thank you man! You awesome!

  • @yushinkim3695
    @yushinkim3695 4 ปีที่แล้ว

    Hi. this video helped a lot to my project. and Thanks...
    Can we move next Level little bit faster? when we swipe the screen it goes next level hardly. I needed to swipe almost half of the screen to go next level. so Can you move it earlier like when we swipe just around 1/3 of the screen it can go next one... Is it possible?

    • @gabe_marcos8027
      @gabe_marcos8027 3 ปีที่แล้ว

      Have you found a way of doing this?

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

      @@gabe_marcos8027 Hi, try increasing number 2 to 4 in first for loop, and also at the beginning of "else" copy and paste code from if statement above

    • @gabe_marcos8027
      @gabe_marcos8027 3 ปีที่แล้ว

      @@Jigglychad Thank you so much. I'll try that.

    • @Nefix7314
      @Nefix7314 3 ปีที่แล้ว

      @@Jigglychad Hello, I don't quite understand what you mean, so sending me the code would be very nice Thanks in advance

  • @csgo-funmoment_official3059
    @csgo-funmoment_official3059 4 ปีที่แล้ว

    Wow!!!Thank You!
    From Russia

  • @liyanadini7694
    @liyanadini7694 4 ปีที่แล้ว

    any idea how i can use this in VR and program the swipe using the Vive pro controller? I hope to get a few feedback from u guys! as I'm using it for my school project! this will help a lot!!

  • @nikolabozin1946
    @nikolabozin1946 3 ปีที่แล้ว

    Hey, is there a way to increase sensitivity of scroll? Its kinda hard to scroll left and right on phone.
    I would appriciate any help!

    • @gabe_marcos8027
      @gabe_marcos8027 3 ปีที่แล้ว

      I'm also trying to do this, have you managed to make it more sensitive?

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

      @@gabe_marcos8027 nah, i tried to make some fixes, but it didnt work. I just left it like it was

    • @ParasGargBCE
      @ParasGargBCE 2 ปีที่แล้ว

      @@gabe_marcos8027 Have you managed to make it more easily scroll?

  • @arashsh4513
    @arashsh4513 5 ปีที่แล้ว

    how use this for level up? in every level complete change value scrollbar horizontal ++

  • @satyamvishwakarma8682
    @satyamvishwakarma8682 3 ปีที่แล้ว

    Worth Watching!!

  • @shwite
    @shwite 4 ปีที่แล้ว

    So nice really good job man !

  • @ronaldlee320
    @ronaldlee320 3 ปีที่แล้ว

    the script not suit for vertical version

  • @Wonder_Verse_Tech
    @Wonder_Verse_Tech 4 ปีที่แล้ว

    That's what I wanted.... Thank you so much ... Plus one subscriber for you 😍😎

  • @pangidoannasution3870
    @pangidoannasution3870 4 ปีที่แล้ว

    Makasih tutorialnya bang
    Kalo bisa bikin effect sound nya jugak
    Kayak main menu GTA hehe🙏🙏🙏

  • @davidmorales1163
    @davidmorales1163 ปีที่แล้ว +5

    I found a way to accomplish the desired effect by adjusting the local scale of the children based on the scrollbar's position while maintaining the required "Screen Space - Overlay" render mode.
    for (int i = 0; i < pos.Length; i++)
    {
    if (scroll_pos < pos[i] + (distance / 2) && scroll_pos > pos[i] - (distance / 2))
    {
    // Scale the current child to 1f, 1f, 1f
    transform.GetChild(i).localScale = Vector3.Lerp(transform.GetChild(i).localScale, new Vector3(1f, 1f, 1f), 0.1f);

    // Scale all other children to 0.8f, 0.8f, 1f
    for (int a = 0; a < pos.Length; a++)
    {
    if (a != i)
    {
    transform.GetChild(a).localScale = Vector3.Lerp(transform.GetChild(a).localScale, new Vector3(0.8f, 0.8f, 1f), 0.1f);
    }
    }

    break;
    }
    }

  • @PDCMYTC
    @PDCMYTC 4 ปีที่แล้ว

    Thanks so much for this tutorial dude! Helped a lot! You are very underrated!

  • @janithasandun6667
    @janithasandun6667 4 ปีที่แล้ว

    in this video i want to auto scroll to some point in start,how can i do this?

  • @WidiyantoRizky
    @WidiyantoRizky 2 ปีที่แล้ว

    I love The Script make me smart

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

    Лайк этому красавчику!!!!

  • @jakedavid7430
    @jakedavid7430 4 ปีที่แล้ว

    Im in the last part but when I press play, the text inside the buttons disappear. Can u tell me where i went wrong. I used buttons text mesh pro

    • @maozgrossman5927
      @maozgrossman5927 3 ปีที่แล้ว

      I think this is because you use Vector2 instead of Vector3 so z is set to 0
      try
      Vector3.Lerp(transform.GetChild(i).localScale, new Vector3(1.2f, 1.2f,1.2f), 0.1f);
      and
      Vector3.Lerp(transform.GetChild(j).localScale, new Vector3(0.8f, 0.8f,0.8f), 0.1f);

  • @AIArtistNoahC
    @AIArtistNoahC 2 ปีที่แล้ว

    대박! 이런기능이 있었군요!

  • @everkumaat6702
    @everkumaat6702 3 ปีที่แล้ว

    Bisa dibikin looping gak?

  • @lib4861
    @lib4861 4 ปีที่แล้ว

    Kalau swipe nya pakai button gimana kak y, contoh nya ada 2 button yang satu untuk swipe ke kiri dan tang satu ke kanan, please buatkan tutorialnya kak,

  • @mihirpanchal3575
    @mihirpanchal3575 2 ปีที่แล้ว

    how to get code recourse of this content?

  • @sayyidj6406
    @sayyidj6406 3 ปีที่แล้ว

    Bang kalau scale nya dirubah jadi fullscreen buat di android bisa ga? 0,1f itu maksudnya apa ya bg

  • @bianeytapia7622
    @bianeytapia7622 3 ปีที่แล้ว

    #2021 #COVID so friend thank you

  • @muhammadtalhaali2541
    @muhammadtalhaali2541 4 ปีที่แล้ว

    bro can you tell me how to make the level pop like if i know ive won certain level how to start this menu screen from that position for instance if i won level 1 how to move the Content gameobject through script ?

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

    Awesome, thank you

  • @richardkareem2320
    @richardkareem2320 2 ปีที่แล้ว

    bang gua kok malah balik lg ke slide awal gabisa netap gitu
    ?

  • @maribelmaytafuentes2219
    @maribelmaytafuentes2219 4 ปีที่แล้ว

    thank you.. It help me

  • @BradleyBurks
    @BradleyBurks 4 ปีที่แล้ว

    Thanks for the video! Well done!!!

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

      After doing some more research on this with different screen resolutions. It does not adapt well as far as I am seeing. Is there something I am missing maybe?

  • @시청-d8q
    @시청-d8q 3 ปีที่แล้ว +2

    감사합니다. Good!~

  • @MrTrotta2010
    @MrTrotta2010 3 ปีที่แล้ว

    Awesome tutorial!

  • @daudaryarafa2442
    @daudaryarafa2442 2 ปีที่แล้ว

    Can any one give me the work source code? Mine always error because float[ ] cant initialize lenght

  • @kanandasa1616
    @kanandasa1616 3 ปีที่แล้ว

    Bang tolong tutor swipe control with sounds pada object yang berbeda-beda

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

    Kamal kar gaya larka

  • @Bobby59452
    @Bobby59452 3 ปีที่แล้ว

    mantup soul sensei

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

    halo kak, script yang versi vertical apakah kaka tau?