Unity UI Canvas Anchors explained

Поділитися
Вставка
  • Опубліковано 26 січ 2025

КОМЕНТАРІ • 49

  • @ChristinaCreatesGames
    @ChristinaCreatesGames  9 місяців тому +6

    I hope you enjoyed this tutorial 💛 Next one is going to be about the Canvas and Canvas Scaler component, so I hope you'll stick around. In this tutorial, I kep the Canvas Scaler to constant pixel size so the amchoring is easy to see from resolution to resolution, but really, we rarely want our UI to shrink down to ant size for our high resolution players ;) Looking for a friendly community? You're welcome to join: discord.gg/Gy7a9h3APK

  • @Hazzel31337
    @Hazzel31337 9 місяців тому +1

    i definitly needed this video in my life, most of the time i click the anchor buttons and hope for the best xD i didnt knew the positions can change into spacing values, thats nice

  • @lucnoei
    @lucnoei 9 місяців тому +1

    Fantastic as always! I've only done a bit of UI but anchors and layout groups can do powerful stuff

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  9 місяців тому

      Thank you :D! Yes, anchors are awesome. Layout groups can be, as well 💛

  • @AnEmortalKid
    @AnEmortalKid 9 місяців тому +1

    i needed this. i just clicked buttons and dragged things until they looked good. Didn't realize you could be so precise mathematically since the positions are relative and not absolute.

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  9 місяців тому +1

      Design has a surprising amount of math involved :D Luckily it's all rather basic ;)

  • @alexleonardkrea
    @alexleonardkrea 9 місяців тому +1

    Fantastic Video 🔥

  • @TheArghnono
    @TheArghnono 9 місяців тому +7

    The best explanation I have seen of this confusing topic.

  • @pavlovsdoguk
    @pavlovsdoguk 9 місяців тому +1

    yes! I needed this video!

  • @mktwinsmovies
    @mktwinsmovies 9 місяців тому +1

    This is so helpful. Thank you. I always struggle with this. I'm really surprised Unity doesn't offer a simplified wysiwyg autocalculate layout setting. I realize having nuance controls can be useful. But I really believe it should adapt by default and maybe have a fixed or resize setting. It should be possible to anticipate scale changes automatically in most cases. But for now, thank you very much for showing how 😊

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  9 місяців тому +1

      Thank you :) Maybe I'm reading it wrong, but it sounds like you're looking for the Canvas Scaler component. Basically, the workflow would be to set one default size for your UI (1920x1080 would be a good choice) and create the UI for that size, anchoring everything and sizing everything as you need it. While doing so, check if the placements of elements are still correct on other resolutions and change values inside the Canvas Scaler as you need them - that will prohibit your UI from shrinking down to ant-sized on especially high resolutions, for example. I'll give a walkthrough of Canvas and Canvas Scaler in the next tutorial =)

    • @mktwinsmovies
      @mktwinsmovies 9 місяців тому

      @@ChristinaCreatesGames Thank you for your reply. That may be what I'm looking for. I don't think I've tried the Canvas Scalar component and appreciate if it is in an upcoming tutorial :) I also learned recently doing a project that for mobile webgl, I check for screen orientation (height x width) and enabled a different canvas for landscape or portrait. I couldn't get things to layout correctly as easily otherwise even using grids I think. But I found switching canvases for orientation helped, unless there is a better way. Thank you again for all your great content!

  • @MultiToto07
    @MultiToto07 8 місяців тому +2

    Underrated video

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  7 місяців тому

      I hope it will pick up speed in the next weeks :) But glad you enjoyed it!

  • @lauren456
    @lauren456 9 місяців тому +1

    Your videos are so fantastic. Always clear and helpful, thanks!

  • @Ferenc-Racz
    @Ferenc-Racz 3 місяці тому +1

    Thank you for your video / explanation. It helped a lot to understand. :)

  • @nekokna
    @nekokna 9 місяців тому +1

    Awesome,thanks!!

  • @tomq6491
    @tomq6491 8 місяців тому +1

    Excellent explanation and not your first! Thanks

  • @RelaxingBassoonMusic
    @RelaxingBassoonMusic 7 місяців тому

    Great explanations - thanks!

  • @rashadsworld_
    @rashadsworld_ 5 місяців тому

    This video helped me truly understand anchors and pivots which I’ve been avoiding for the longest time!! 🙏🏿
    PLEASE make a video on using the asset “Better UI”. I brought it a while ago because I’m trying to figure out how to make menus that look good in landscape and portrait orientation.

  • @zeycus
    @zeycus 6 місяців тому +1

    This explanation is awesome, much better than other videos. However there is something I miss, maybe because I am a complete newbie and confusing things. But I think this video could clarify that the behaviour we are seeing happens when the canvas is in Constant Pixel Size. That is why when we move from 1920x1080 to 4K, everything gets half size. Setting it to "Scale With Screen Size" stops it from happening, although if the proportions between resolutions are not the same, there is an additional "Scren Match Mode" that affects how things work.

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  6 місяців тому

      Glad you found the video useful! I think you might enjoy this one I made specifically for the Canvas and Canvas Scaler components. I'm going into scaling in there :) ua-cam.com/video/1OwQflHq5kg/v-deo.html

  • @fv4202x
    @fv4202x 9 місяців тому +1

    I always use alt+shift+leftclick when aligning. I dont see any reason why I should use other options

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  9 місяців тому +1

      If that works for you, great! I'm typically just shift-leftclicking and will set the pivot later to finetune. I like that the system is built with shortcuts like these quickly available.

  • @luiginicastro1101
    @luiginicastro1101 6 місяців тому +1

    Incredible video thank you! Any chance you will be creating a dynamic UI video?

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  6 місяців тому

      Thank you =) I'm sure it will be a topic I cover at some point, seeing as my whole channel is almost all about UI. But feel free to mention any specifics you'd be interested in!

  • @roican3304
    @roican3304 9 місяців тому +1

    I do not know if it is stupid or harmful, but to create screens that I want to remain identical for all resolutions I create a new object which I put as parent of all my UI elements, set stretch horizonal+vertical and add an Aspect Ratio Fitter component to it with Aspect Mode: Fit in parent and Aspect Ratio: 1.777778 (16/9).
    The background however must NOT be a child of this object or at different resolutions it would leave part of the screen without background.
    I don't know if this is the best way, but maybe it will help someone.
    PS. The canvas Scaler must be "Scale with screen size" with reference resolution = the target resolution (like 1920x1080)

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  9 місяців тому +1

      If you use anchors and make good choices in the Canvas and Canvas Scaler element, you shouldn't run into any issues :) I wouldn't call your solution stupid or even harmful, more like a creative solution that requires a more robust redo 💛 I'll takle the two Canvas components in the next video, hope to see you there, too!

  • @hangry_demure
    @hangry_demure 6 місяців тому +1

    Thanks!

  • @kpm25
    @kpm25 27 днів тому

    Thanks a lot!!

  • @JustAhmed_yt
    @JustAhmed_yt 9 місяців тому +1

    BRO JUST YESTERDAY I FIGURED IT OUT ,

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  9 місяців тому +1

      Thank you for dropping by, anyway :D! Hope you'll still take something away from this :)

    • @JustAhmed_yt
      @JustAhmed_yt 9 місяців тому

      @@ChristinaCreatesGames Thnx ;)

  • @dj_s5564
    @dj_s5564 Місяць тому

    Hello, where can I find a relatively systematic free UGUI tutorial?
    I am reading Master Ui development with unity,
    which is almost the only UGUI book I can find, but the text alone does make me have some difficulties in understanding,
    which is why I found this video.

  • @honestlyruthless
    @honestlyruthless 9 місяців тому

    you have a very soothing voice

  • @PedrovoriskAB
    @PedrovoriskAB 5 місяців тому +1

    What a great video. Thank you for the class. Anyways no matter what I do never works for me things in UI just a sad system. Really. I wish it was more simple I can code an entire game but I cant make the UI work like I want..

  • @user-hq3zi2fh9e
    @user-hq3zi2fh9e 2 місяці тому

    👍

  • @MajorBatman
    @MajorBatman 9 місяців тому +1

    Should be required viewing before doing any UI work in unity!

  • @Hex-.
    @Hex-. 3 місяці тому

    i cant see shit💀🙏🙏