Position your UI, using screen space! [Tutorial][C#] - Unity tutorial 2019

Поделиться
HTML-код
  • Опубликовано: 4 фев 2025

Комментарии • 45

  • @MadMikeAU
    @MadMikeAU 3 года назад +6

    Thank you. While there are a bunch of videos in this subject, you managed to explain in it under 15 minutes. That is the sole reason I watched this one. Was not disappointed!

  • @mystirboy
    @mystirboy 5 лет назад +3

    UI stuff always felt very clunky to work with for me. Your stuff makes me learn a lot.

  • @aldigangster123
    @aldigangster123 4 года назад +2

    simple but very good tutorial. Especially because you mentioned the redrawing "issue" of non-static canvases. That is rarely ever mentioned anywhere.

  • @theodorescontras5569
    @theodorescontras5569 2 года назад

    THANK YOU for this lol, I was slamming my head against a wall for hours trying to figure out how to convert world space to canvas space and this works *perfectly*

  • @GameOnBudget
    @GameOnBudget 3 года назад +2

    Thanks You Brother ! You Saved My Azz xD

  • @maryneko-chan3035
    @maryneko-chan3035 3 года назад +1

    Thank you so very much for this tutorial! It's simple and well explained. ^o^

  • @AgentCryo
    @AgentCryo 2 месяца назад

    Thanks so mutch, I was looking for this. Everywhere wants only world space UI and not screen space.

  • @issacthompson330
    @issacthompson330 4 года назад +4

    Thank you. I was looking for a way to move a UI element to specific places and I would not have discovered the WorldToScreenPoint function in time to finish the game for the Jam i am taking part in.

  • @r1pfake521
    @r1pfake521 5 лет назад +3

    You can change the render settings of the 3d object/text so that it will be on top of everything else and always fully visible/readable. The screen space solution is still better in this case, but the other statement is a bit misleading.

  • @V-post
    @V-post 11 месяцев назад

    Simple and to the point. Great

  • @nikson12gg
    @nikson12gg 4 месяца назад

    Thank you for this video. Could we also make it so screen space UIs can be overlapped like gameobjects do? For example in Lineage 2 game, when NPC objects are being covered by buildings or trees or something, their name tags are also covered

  • @runrajrun
    @runrajrun 2 года назад

    Thanks dude! This helped a ton :D

  • @abdullahkrmzyuz5827
    @abdullahkrmzyuz5827 5 лет назад +1

    Keep it up man !

  • @OnWeek
    @OnWeek 3 года назад +2

    Ajudou demais mano, simples e eficiente, te amo

  • @oscarmartinez-zb8yx
    @oscarmartinez-zb8yx 2 года назад

    This was great , it wasnt exactly what i was doing but it made me understand how it works and figure it out by myserlf

  • @igeprogrammer
    @igeprogrammer Год назад

    This is exactly what i need

  • @whidzee
    @whidzee 5 лет назад +3

    Great tutorial. It works just as you showed, but if you're object is off the screen the icon slowly makes it's way into the centre of the screen until i move to see the object again. is there a way to kill this if the object is not on screen?

  • @captainawesome2226
    @captainawesome2226 18 дней назад

    Shouldn't you be using RectTransform instead of Transform and anchoredPosition instead of position for UI elements so that they are platform and resolution independent?

  • @xAjido
    @xAjido 4 года назад +2

    Video starts around 2:00

  • @Raskelot
    @Raskelot 5 лет назад +1

    Very useful thanks

  • @alexbarra
    @alexbarra 2 года назад

    Hi there, it worked properly but only in FixedUpdate! In Update doesn't work as expected.

  • @random_precision_software
    @random_precision_software 5 лет назад

    What would be good if you had a sprite image that moves to and locks on to that sprite image like in F16 flight sim game.

  • @samiismonov2577
    @samiismonov2577 5 лет назад

    Nice. Thanks a lot

  • @williamallen6382
    @williamallen6382 4 года назад +1

    How would you write the script for a 2d game?

  • @Darkon5524
    @Darkon5524 5 лет назад

    Great tutorial! How would you make it scale by distance? So that it keeps its own relative size above the "Enemy" position, and gets smaller the further the enemy moves from the camera in world space, and returns to a scale of 1 when the enemy is right ontop of you.

    • @therondoshow
      @therondoshow 3 года назад

      For this you can use the world space (3D) canvas he shows first. The UI element would exist within the 3D scene and will scale depending on distance from the camera. I think maybe you could then use sorting layers to ensure the UI element is displayed on top of everything.

  • @Geckotr
    @Geckotr 2 года назад

    script works but it's glitchy on my project. It's flickering and doubles while it's on a moving object

  • @yudingzhou8683
    @yudingzhou8683 5 лет назад

    thank you!

  • @ridhobagusprayoga_3036
    @ridhobagusprayoga_3036 Год назад

    ok tq bro

  • @demis9643
    @demis9643 2 года назад

    Doesn't work, object reference not set to an instance.

  • @THEROTOM22
    @THEROTOM22 5 лет назад +1

    Ah Yeah!! Dark Souls health bars

  • @tesil123
    @tesil123 5 лет назад +1

    I like

  • @basspiramida748
    @basspiramida748 4 года назад

    super

  • @karseth5760
    @karseth5760 5 лет назад

    Noice!

  • @AuditorsUnited
    @AuditorsUnited 4 года назад +1

    using UnityEngine;
    public class textHover : MonoBehaviour
    {
    [Header("Tweaks")]
    [SerializeField] public Transform lookat;
    [SerializeField] public Vector3 offset;
    [Header("Logic")]
    Camera cam;

    // Use this for initialization
    void Start()
    {
    cam = Camera.main;
    }
    // Update is called once per frame
    void LateUpdate()
    {
    Vector3 pos = cam.WorldToScreenPoint(lookat.position + offset);
    if (transform.position != pos) { transform.position = pos; }

    // transform.LookAt(cameraToLookAt.transform);
    //transform.rotation = Quaternion.LookRotation(cameraToLookAt.transform.forward);
    }
    }

    • @Geckotr
      @Geckotr 2 года назад

      yyyessssss thank you so much! It solved the glitch for me!!!!

  • @Jacob___THE_Jacob
    @Jacob___THE_Jacob 4 года назад

    xp

  • @MasterOfCookie
    @MasterOfCookie 3 года назад

    Thanks man