Announcement

Collapse
No announcement yet.

UMG Widget: Stay on screen - But how?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UMG Widget: Stay on screen - But how?

    Hi,

    I'd like to align a 2d widget to an actor. To do this, I added the widget to a canvas and I'm setting it's canvas panel slot's position in the tick function. This works very well to a certain point.

    As you can see in the attached image, if the actor is too close to the edge of the screen, the widget gets clipped and a part of it moves out of the screen. I want the widget to stay on screen without being clipped and constrain it to the player's screen. Is there a simple way to achieve this behaviour?

    Click image for larger version  Name:	widgetscreen.jpg Views:	1 Size:	41.9 KB ID:	1590522

    Thanks in advance and kindest regards,
    Daniel
    Last edited by polygon; 03-02-2019, 12:11 PM.
    Daniel Mihajlovic |Freelance 3D Artist | Showreel

    #2
    Yup, before setting its position, check viewport / canvas size and subtract the widget size - that's your clamp.

    Comment


      #3
      Thank you so much for your quick reply! It works like a charm and saved me so much time!
      Daniel Mihajlovic |Freelance 3D Artist | Showreel

      Comment

      Working...
      X