Access Blueprint variable in C++

Hello!

Is there a way to read BP variable inside C++ code? For example, for my inventory system, I created a BP Actor Class called : InventoryComponent which I added to my BluePrint Character class and I want to read this variable in C++ to access the list of Item (Item is a BP class) it contains, how can I do that ?

Thank you

With this following code : InventoryComponent* Inventory = FindFieldChecked<InventoryComponent>(BlueprintClass, TEXT(“InventoryComponent”));

I get UndeclaredIdentifier InventoryComponent, Inventory and BlueprintClass

It is better to declare the variable in C++ and use it in Blueprint doing it the other way around is a workaround.

How can I declare it, if my variable is of type BluePrint Actor Component?

I believe BP Actor Component is the same thing as C++ Actor Component. Declare this component in C++, create subobject if needed, expose to BP using UPROPERTY() macro.

Yes make the Actor Component in C++ and derive your BP component from this.