This is sort of a broad question concerning how sub-object pointers are meant to function in UE4. What I’ve been trying to do for a few days is to allow the editor to modify sub-object pointers to components of an actor.
For example:
UCLASS(config=Game)
class AMyActor: public APawn
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, Category = Character)
UMyComponent* MySpecialComponent;
};
It should be clear what I want to do here. Anytime a user in the editor creates a component on this actor of type UMyComponent, I want them to be able to point the property MySpecialComponent at it so that AMyActor can use it for special things. If this were possible, it would strike me as an intensely useful tool for giving users the ability to customize the actors that they make.
I would like this to work for both Blueprint archetypes as well as instances, but would be okay if it only applied to archetypes. As it stands, the property will only show up in the details panel at all if it’s an instance, and there is no way to edit those pointers. My foray into making some editor code to manually point them resulted in a variety of issues I believe related to this bug.
The whole thing has left me confused what the engine’s intent is for sub-objects and default sub-objects. CreateDefaultSubobject lets the class create, well, a default sub-object but the user can’t replace it with anything else?
The question extends to widgets and UMG. If I have a class that inherits UUserWidget I want the user to be able to specify pointers to sub-widgets. For example, if the user wants an image to receive, in code, something game-related, it would make a lot of sense for the user to be able to point a property in that UUserWidget to that sub-widget. Unity is very seamless with stuff like this, allowing you to specify internal object references with no problem, allowing for a huge amount of editor customization, but I’m sitting here sort of lost in Unreal.