Have you set your reference in hud ? If your capsule is in level blueprint : “Create a reference of capsule 1”. On event begin play get player controller / get hud / ( edit : / cast to your hud ) / “set capsule 1 variable” with reference. If capsule is spawned, do the same and set with the return value of “spawn actor of class”.
The capsules are just ‘shape narrow capsules’ dragged into the scene and then turned to blueprint. Communication between them works fine (eg passing variables), but communication to the HUD blueprint does not and gived the error.
I am a bit staggered because I have done this type of BP communication hundreds of times, and suddenly, when I want to create my first HUD, it fails.
I took screenshots. It is easy to replicate in literally 1min: create a new project with starter content and add the 3 BP as shown.
What you see in the screenshots is what I did straight after creating the new project. Nothing else.
When I print capsule 1’s float variable by ‘print string’ in capsule 2, it works. So BP communication works. (screen 1,2,3,4)
When I want to the same with the HUD BP, I get the error. (screen 5,6)
It is the same error that I get, when I do not set the Capsule 1 as default in the Capsule 2 details panel after adding it as variable.
How can I work with capsule 1’s variable in the HUD Blueprint? Very simple, very basic question.
How are you creating the HUD though? How are you setting the reference to Capsule1 in TestHUD? That will not automatically be set. You are better off utilizing the GameMode. Create your own GameMode, for example TestGameMode and put variables on them to store your capsules and HUD references. Then when you need to access something on one of those objects, simple get the current game mode and cast it to “TestGameMode” and grab the correct reference.
Tommy, your reply does not help me.
How do I communicate between a blueprint HUD and a narrow capsule BP to pass variables?
How I set it up:
It is all in the screenshots.
HUD is created by right-click, then new class, then all classes, then HUD. Just the standard way.
GameMode as well by right click, then add class, then game mode.
Then select GameMode in WorldSettings. Select HUD in GameMode. The usual stuff.
Referencing is done by direct blueprint communication (add new variable in blueprint, then for type choose the other blueprint)
Guys, just replicate the scene how I desctibed it and try yourself, it is really only 1-2mins!
Do it with the narrow capsules to represent any scene object, and not some special player BPs or something.
How to I get a variable from any mesh in the scene that is a blueprint to the HUD Blueprint to plot it on screen ???
I quickly set up the basic scene: two capsules, one HUD BP, one GameMode. (2MB)
Whoever gets the TestVariableforPassing from capsule 1 displayed using the HUD BP first, gets my $30 from the marketplace transferred.
I still have those from when EPIC went free. There is nothing worth it fro me on the market place right now.
Please post screenshot of successful display and all necessary blueprint nodes and settings!
I am not getting it done using Epics’ UE4. Such a basic thing. If I attempt the same communication for capsule 1 <-> HUD as for capsule1 <-> capsule 2, I get an error.
Right now, the TestVariableforPassing is printed using capsule 2 (the rolling 999999). I want it displayed where the text is instead.