Casting

Inventory class is the base class for Weapon.

Current Inventory slot is declared in WeaponEssentialsCharacter.h


UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Inventory)
		AInventory* CurrentInventorySlot;

I have declared current ammo variable in weapon.h as:


UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Config)
		int32 CurrentAmmo;

Having trouble casting in blueprints, I know how to cast in code, e.g.


AWeapon* Weapon = Cast<AWeapon>(CurrentInventorySlot);

I don’t understand why this isn’t working.

Hello,
Your “cast to weapon” exec input and output need to be connected.

Thanks alot. Worked perfectly once I attatched exec input to MyCharacter and output to set text.

As a side question, why don’t Widget blueprints show the ‘arrows’ going to and from nodes when you play the game like they do in normal blueprints?

I am happy that helped you ^^
I don’t understand what you mean by arrows. If you could give a link or a pic of it, i could try to figure.

You can see how lines are pulsating when the game is being played to show it’s working.

Oh ok, this is the debugging :
Blueprint Debugging | Unreal Engine Documentation I don’t know why it doesn’t work for umg (maybe because it needs to be set in level…)

Debugging works in UMG - you need to specify what instance to debug at the top, where it says Debug Filter.

-Nick