Hi guys,
I am implementing a Pickup Item in my current project and have stumbled across something I would really love to do but cannot figure out how to do. It is a very hard question to phrase so I will try to give a code snippet and some context.
I currently have an extremely basic Pickup Item class. For simplicity, I am removing everything that is not relevant to the issue, so it will not be my full class.
UCLASS()
class AWeaponPickup : public AActor, public IInteractable
{
GENERATED_BODY()
public:
private:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickup Properties, meta = (AllowPrivateAccess = true))|
class UWeaponData* weaponData_;
}
As you can see, I have a class that holds all the current weapon parameters as a member variable of my Pickup class. I have this class so I can transfer that data when I am picking up / dropping things from an inventory. Below is a subset of items I have in the weapon data class.
UCLASS(Blueprintable)
class UWeaponData : public UBaseData
{
GENERATED_BODY()
public:
UWeaponData();
// Ammo in one magazine
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Data | Weapon")
int ammoPerMagazine_;
// Current ammo in the magazine
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Data | Weapon")
int ammoCurrentMagazine_;
// Initial ammo in the magazine
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Data | Weapon")
int ammoInitialMagazine_;
}
My goal is to expose the UPROPERTIES of that Weapon Data class INLINE in my editor, without having to make another blueprint. The below screenshot is what I get out of my Weapon Pickup class, which forces me to create another blueprint of the Weapon Data, and that seems unnecessary.
Below here is what I would like to see IN the WEAPON PICKUP blueprint.
I am trying really hard to minimize the blueprint overload when I really only care about the initial values of this weapon and want to be able to tweak them from weapon to weapon. After the game has started, the persistent weapon data should stay in sync.
It seems like a lot of UE components allow for this, I.E, how you can set the skeletal mesh of a skeletal mesh component. It seems like this only works when the component is instantiated and “attached” in the constructor but I cannot attach my UObject class which makes me think I simply cant get this functionality.