Hi,
I m adding a component to character class by using a_pointer_declare_in.h = CreateDefaultSubobject(TEXT(“Somename”));
But once the game start and using bp to check if a_pointer_declare_in.h is valid i got false do i miss some steps to get it work?
More than this in detail panel i can t see properties mark as editanywhere.
When i add the component with addcomponent button in blueprint editor those components are valid.
Any idea on the problem?
In the character .h
- UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Inventory, meta = (AllowPrivateAccess = “true”))
- class UPlayerInventory* PlayerInventory;
In the character .cpp constructor:
- PlayerInventory = CreateDefaultSubobject<UPlayerInventory>(TEXT(“PlayerInventory”));
Class declaration & propery declaration:
- UCLASS(Blueprintable, BlueprintType, meta=(BlueprintSpawnableComponent))
- class MYPROJECT_API UPlayerInventory : public UActorComponent
- GENERATED_BODY()
- UPROPERTY(EditAnywhere, Category = “Inventory”)
- int32 MaxSlots;
EDIT: i have the exact same problem of this guy: https://www.reddit.com/r/unrealengine/comments/bss70y/how_to_create_a_custom_uactorcomponent_properly/eopr7r8/