I’m trying to have custom messages appear on my screen, controllable from my Character BP. Here are the blueprints:
And i also have a function in my character bp called “Message”, that I plan on using often:
What happens is the cast in the widget bp fails, and nothing is returned.
I know this is not the most efficient way to do this, but that’s all I could find. Help?
You cast PlayerController to PlayerCharacter? Try to replace GetPlayerController node in your widget BP to GetPlayerCharacter
Personally I use the GameMode Blueprint for just about every variable I need to transfer between blueprints.
First of all you dont have to create a new Message Widget everytime if you just want to display one Message. They will all share the same Message from the Character if you try to pull it the way you got right now.
If you want individual Messages like a Chatlog or something you can Expose your “Message Text” in your Widget on Spawn and directly pass it along. On Construct Event inside your Widget you get the Message Text and set it to your Text Widget directly via the Set Text Node. Your Widget does not need to listen for change events or even know from who the Messages comes. You can get rid of your Get Text 0 function and make sure you unbind it in your Text Widget. You can also get rid of your Text variable inside your Character. Not needed.
Have Fun and good Luck =)
Are you sure your Default Pawn Class in your GameMode Configuration is ThirdPersonCharacter?
Or may be, you must delete your GetText0 first, then remake it again. I’ve ever had such that problem, but then when i re-made the bind function, it worked