Download

UMG and C++

Hello guys,

I am trying to figure out a way to attach a c++ script to a button in umg. What I am basically trying to achieve is a read and write button in UMG which when clicked run c++ scripts for reading text from a text file or write text to a text file…any help is appreciated. I’m really stuck. Thank you.

There are two simple ways to solve your problem.

  1. Use C++ blueprint function library
  2. Create a C++ UserWidget and write your code, then create child UMG from it.

I suggest that you create a blueprint-accessible function in C++ and call it from your widget. File operations in the widget itself seem like “magic button” anti-pattern to me.