Announcement

Collapse
No announcement yet.

Variable widgets in functions

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

    Variable widgets in functions

    Hello everyone.

    I've been using the Unreal Engine a lot over the past week. I've recently hit a dilemma that I haven't been able to solve through Google.

    So I created a UI widget, MenuItem, which is a widget that will be the child of a different UI widget, Menu.

    I created a function for MenuItem called SetText. This is where I'm having issues. On the MenuItem widget, there is a text widget which is assigned to the variable Title. Now all I wanted this function to do is to set the text of Title. However, when I run it, I get the error: "Accessed None trying to read property of Title from function: 'SetText'".

    I call the SetText function on an instance of MenuItem in the Menu Blueprint. It manages to retrieve the input just fine, but it doesn't seem to know what the value of Title is.

    I'll leave the Blueprint screenshot below to help out.

    SetText Function


    Calling SetText


    Title Variable


    Thanks for your time,

    Binkadin.
    Kind Regards,
    Binkadin.

    #2
    You have to bind that variable to the widget, not set from the BP. Click on the text and in content click bind and past there your text. Otherwise create a new variable and past the content. Then bind the text of the widget with that variable.

    Comment


      #3
      Originally posted by Siengried View Post
      You have to bind that variable to the widget, not set from the BP. Click on the text and in content click bind and past there your text. Otherwise create a new variable and past the content. Then bind the text of the widget with that variable.
      Thank you for your assistance.

      I had to understand how this worked a little more through Google. For anyone that needs to know the answer to this, this is what I did:
      - Created a new text variable.
      - Clicked the pull down by text under content and selected my variable name to bind them together.
      - I then created a small function which sets the value of the text variable. It worked perfectly.

      Once again, thanks a lot for your help.
      Kind Regards,
      Binkadin.

      Comment

      Working...
      X