Hi,
I’ve just started learning Unreal and I’m trying to expose a variable from one of my classes to be set in the editor.
For example this code works fine:
UPROPERTY(EditDefaultsOnly, Category="Particles")
UParticleSystem* ParticleSystem;
I can then assign any particle effect I want. However if I want to do the same thing for a custom class I have made, it no longer works:
UPROPERTY(EditDefaultsOnly, Category="Weapon")
APXBaseWeapon* MyWeapon;
I can see the field under Class Defaults in the editor, but I can not select any of my APXBaseWeapon subclasses, or even the base class itself (including blueprint extensions of these). The only way I can get it to work is to do:
UPROPERTY(EditDefaultsOnly, Category="Weapon")
TSubclassOf<APXBaseWeapon> MyWeapon;
Why are they different? I’m confused why I have to use two separate methods when I feel like I’m essentially doing the same thing.
Thanks!