I’m trying to create a UMagicWeapon class that a capsule component subclass will have a pointer to as a UPROPERTY class member and that will be settable from the editor, but so far I can’t get premade Blueprint subclass assets to show up or any option to create a new object of the UMagicWeapon type. The capsule class setup looks like:
...
#include "SpellCapsuleComponent.generated.h"
/**
* A capsule collision geometry for a bullet or spell effect
*/
UCLASS()
class RYDDELMYST_API USpellCapsuleComponent : public UCapsuleComponent, public IAttacker
{
GENERATED_BODY()
public:
...
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Combat")
UMagicWeapon* Magic;
public:
USpellCapsuleComponent();
...
};
and USpellCapsuleComponent constructor looks like:
USpellCapsuleComponent::USpellCapsuleComponent()
{
SetNotifyRigidBodyCollision(true);
SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
SetCollisionProfileName("BlockAllDynamic");
Magic = CreateDefaultSubobject<UMagicWeapon>(TEXT("Magic Weapon"));
}
UWeapon class setup looks like:
...
/**
* An object representing a weapon of some sort, e.g. a sword or claw. It has a map of Attacks it can perform which include data such as the damage type an attack inflicts, the base damage value etc.
* Weapons functionality can then be associated with an appropriate form, e.g. a ClawCapsuleComponent has a ClawWeapon.
*/
UCLASS(ClassGroup = "Combat", editinlinenew, Blueprintable, BlueprintType, meta = (DisplayName = "Weapon", BlueprintSpawnableComponent))
class RYDDELMYST_API UWeapon : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Combat")
TMap<FString, UAttack*> AttackMap;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Combat")
FString CurrentAttackName;
...
};
and the UMagicWeapon class setup (which doesn’t add anything to the Weapon class atm) looks like:
...
/**
* A Weapon that delivers spell effects through its Attacks
*/
UCLASS(ClassGroup = "Combat", editinlinenew, Blueprintable, BlueprintType, meta = (DisplayName = "MagicWeapon", BlueprintSpawnableComponent))
class RYDDELMYST_API UMagicWeapon : public UWeapon
{
GENERATED_BODY()
};
The default Magic Weapon object shows up in the editor, but when I try to override it with a new value in place or a premade Blueprint subclass of UMagicWeapon the list of selectable assets is empty and I don’t get an option to create a new object. I have all filters cleared, but the list remains empty. What do I need to change about the class setups to make the UMagicWeapon field settable in editor?