I have a AActor class in cpp. I created a BP inherits from it named My_Actor_BP. In cpp class i declared some UPROPERTY :
UPROPERTY(EditAnywhere, Category = "Event Section")
TArray<UUserWidget*> Event_Dispatcher_0;
UPROPERTY(EditAnywhere, Category = "Event Section")
TArray<UUserWidget*> Event_Dispatcher_1;
UPROPERTY(EditAnywhere, Category = "Event Section")
TArray<UUserWidget*> Event_Dispatcher_2;
UPROPERTY(EditAnywhere, Category = "Event Section")
TArray<UUserWidget*> Event_Dispatcher_3;
I want to contain some customized widgets in these. I have to say that, these customized widgets are all BP classes which inherits from different cpp classes. And these all different cpp classes inherits from UUserWidget class. In this way, my artist can implement his widget BPs. And i can use them in cpp functions. So far so good.
When i check the "Event Section" in My_Actor_BP, and add a new element to Event_Dispatcher_0 array, element is adding but when i try to choose a asset there will be empty. No recommended BP's or anything.
Probobly the reason of the zero recommendation is the type of the TArray's template type. When i created a BP class from directly UUserWidget, still no answer. What should be this type? Any advice would be great. Thanks in advance.
In the case where you want your user to specify the class of an object to be managed by another object, you want to use the TSubclassOf<> template. In the code above, you're asking the property to point to an actor, but that actor hasn't been created yet. What you want to do is point to the class, and you can then create the widget from that class in your Blueprint or native code.
The source for GameModeBase.h gives good examples of this:
/** HUD class this game uses. */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Classes, meta = (DisplayName = "HUD Class"))
TSubclassOf<AHUD> HUDClass;