I can't figure out what object wildcard I need to use

The BP I posted is from my HUD. This script basically just casts to my generic Weapon BP, gets the ammo and puts it on the HUD. But for the life of me I can’t figure out the wildcard I need to use, and in general I don’t have a great understanding of how they work, please help.

Great. Now where is it spawned? The character spawned it?

Yep, it’s spawned from the character

You need a reference to the instance of that weapon blueprint. How and where is a Weapon_Base created?

Do you spawn it from class, is it laying on the ground in the scene?

It’s spawned from class

Even though it’s not the best way to do it, if I wanted to grant a widget access to the weapon the character has spawned, I’d do this in the widget:

We can’t use the reference yet as the widget has no idea what object the variable is pointing at. We also need this in the character blueprint:

Now both the player and widget can use it. In this case you do not even need to cast.

In this case you do not even need to
cast.

You will need to cast if you now spawn an AK-47 using a weapon base class.


And yet another way is to get Pawn → Cast to Character → get Weapon reference (you still need to create a reference here). Could be done in the widget Construct so you do not spam-cast every frame in order to update every widget field. Not sure why they put that in tutorials.

Unfortunately this method doesn’t work for me as I use a child actor to spawn the weapon in my hands, hence I don’t use the SpawnActor function. Sorry to waste your time :confused: is there any other way?

I don’t use the SpawnActor

You don’t but the Child Actor does, it holds onto an actor. It does not know what actor it is so we to need to cast here:

The rest would be the same.

Alright I did this and it’s working! Oh my god that took so long. You’re a blessing, thank you.

Haha, wicked! Blueprints communication can be quite convoluted.

Passing data forth and back is by far one of the more critical parts, and many methods exist. Some better than others at achieving specific goals.

Good luck with the rest.

Not sure what you mean. If you’re unsure how to create references manually, you can:

Image from Gyazo