Setting instance of Public Variable in Widget Blueprint Broken?

I set up an easy scenario which can be understood immediately. When a button is clicked in the Widget blueprint, it will call the custom event “Say Hello” from the BP_MainGame Blueprint, and then a print string node will run.
(Pic 1 & 2)

In order to call the custom event from my BP_MainGame blueprint, I have set up a public object reference variable. (Pic 3) The type has been set as the BP_MainGame blueprint.

From there, when I want to select the instance of my public variable in the details panel, it gives me the option to select it, yet is never set. (Pic 4 & 5) No matter what I try I can’t set the instance of the variable.

Is this a bug? Am I doing something wrong? Please help~

-Thanks-

20126-3.jpg

20125-2.jpg

20128-5.jpg

Hello BrannenK,

Could you tell me what it is exactly that you are trying to do? If you are simply trying to communicate between the widget and let’s say the MyCharacter blueprint you will need to cast. Here is an example of how to get the set up you have working.

This will be placed in your character blueprint

20247-casthelp2.png

This will be placed in your widget blueprint. To get the “cast to” node to appear you will need to get the player pawn in this case and drag off that pin. If you would like to cast to your player controller you will need to get player controller and so on.

Is this the effect that you are trying to accomplish? I hope this helps.

Make it a great day

Thank you so much for your reply. The main thing I am trying to do is communicate between a Widget and a Class Blueprint.

While casting to MyCharacter may work, the problem I am having is casting to a Class Blueprint. That led me to try and make an object reference variable for the blueprint (as documented in this post.)

How would I go about casting to a Class Blueprint from within the widget? Or was my previous method of attempting an object reference variable the better route to go?

Hello BrannenK,

I will need to know what type of class you are trying to communicate with. Some examples of blueprint classes are:

  • Player Controller
  • Pawn
  • Character
  • Game Mode
  • Actor

To show how this may be different I have included the following example of casting to an Actor class. You can compare this with the first example of casting to a Character class. Once I know what type of class you are referring to I will be able to assist you further.