No announcement yet.

Send text from blueprint to UMG

  • Filter
  • Time
  • Show
Clear All
new posts

    Send text from blueprint to UMG

    Hello. Student and rather fresh user of UE4 here.
    I've been struggling all day with something that might be insanely simple, and I might be overthinking it. So please enlighten me.

    What I'd like to do:
    - Have a blueprint with a collision box/sphere
    - in the construction/event graph, have a text variable that will be editable, so I can change the text for each instance I place in the level
    - The player enters the collision box/sphere, and the text is sent to the UMG, and set to be visible
    - The player leaves the collision box/sphere and the text is invisible again

    The text is things like learning how to use certain controls or hints if you're stuck.

    I've made a system where it draws text on the blueprint itself, but I'd rather have it be part of the UMG gamehud.

    I got some hints from my teacher.
    • make the variables needed in the character blueprint
      in my instance I made
      • (bool) textOverlap
      • (text variable)textLine1
      • (text variable)textLine2
    • in hud umg, bind text content to a function where you cast to character and get the above text variables
    • bind visibility of said texts to another cast to character and the textOverlap bool variable to branch and toggle whether the text is visible or not