I have a setup where I have a UObject that manages an array of another UObject. I can set everything up correctly in the blueprint editor of my actor. When I place my actor in the level it looks like I can edit SomeObjects and the properties of each SomeObject. But anything I do reverts the values back to what was set in the Blueprint class instead of letting me edit the level placed instance. The UI lets me add/remove new elements to the array as well and all my actions get undone as soon as I do them. Unreal’s UI doesn’t gray them out, but saving them doesn’t work.
Actually I noticed I can’t edit any other properties of SomeObjectManager in the component in the editor details. Maybe it’s a problem with how the USomeObjectManager* SomeObjectManager; property is set up and that my component has its own internal default subobject.
This is the sample code of how I set up my properties.
UCLASS(BlueprintType, Blueprintable, DefaultToInstanced, EditInlineNew, Within = SomeObjectManager)
class USomeObject : public UObject
{
GENERATED_BODY()
public:
};
UCLASS(BlueprintType, Blueprintable)
class USomeObjectManager : public UObject
{
GENERATED_BODY()
public:
protected:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, meta = (AllowPrivateAccess = "true"), Category = "SomeCategory")
TArray<USomeObject*> SomeObjects;
};
Then this UObject is a property in a component.
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent))
class USomeObjectManagerComponent : public UActorComponent
{
GENERATED_BODY()
public:
USomeObjectManagerComponent();
protected:
UPROPERTY(VisibleAnywhere, Instanced, BlueprintReadOnly, meta=(AllowPrivateAccess = "true"), Category = "SomeCategory")
USomeObjectManager* SomeObjectManager;
};
USomeObjectManagerComponent::USomeObjectManagerComponent()
: Super()
{
SomeObjectManager= CreateDefaultSubobject<USomeObjectManager>("SomeObjectManager");
}