I have a very simple UOBJECT with a couple of Variables, that I am using to store some data for a type of C++ actor that I drag into my world and adjust the properties of motion in the details panel.
Not sure if Im just tired after a long 12 hr session, but I cant seem to make the properties editable in the Details Panel after dragging into the world.
This is the class I have in my actor that I need to expose to the details panel
Ive tried adding various things in the UCLASS() macro , but while I can see the composition class as a part of my actor after creating it in the constructor, and I can edit the FIntVector by using the dropdown arrow next to the class, Im wondering why the MyDisplacementVector property is not visible directly in the details panel like all my other editable properties are.
Is there something I can add to the UCLASS() macro to make the properties show up inline?
This made me curious, so I did some experiments based on what I think you were going for here.
Im wondering why the MyDisplacementVector property is not visible directly in the details panel like all my other editable properties are.
The short answer: My understanding is that properties of non-component object properties are never visible in an actor’s details panel. UObject* is typically used for references at runtime and not edit-time contained data. If you’ve accomplished this before with a different actor and container object I’d be interested to see how you made this work.
When assigning a regular UObject* in the cpp constructor, either with NewObject<> or CreateDefaultSubobject<>, the instance itself is visible for me in the editor, but none of the properties of the object are editable. If the object is a UActorComponent, then it is inspectable and editable as you would expect.
My recommendation if what you’re trying to do doesn’t end up working, would be to either make your data a UStruct (which can be annoying in its own way, especially if it’s going to be large since structs are value types), make it a UDataAsset which you can then create as an asset and reference in your actor, or to make your settings object a UActorComponent and spawn it in your actor’s constructor. This would depend on the specifics of your use case.
Here’s my test code:
//
// H
//
UCLASS(BlueprintType, Blueprintable)
class UContainerObj : public UObject {
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FIntVector IntVectorData;
};
UCLASS(BlueprintType, Blueprintable, meta = (BlueprintSpawnableComponent))
class UContainerCmp : public UActorComponent {
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FIntVector IntVectorData;
};
UCLASS(BlueprintType, Blueprintable)
class AContainerActor : public AActor {
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UContainerObj* ContainerObj;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UContainerCmp* ContainerCmp;
public:
AContainerActor();
};
//
// CPP
//
AContainerActor::AContainerActor() {
ContainerObj = CreateDefaultSubobject<UContainerObj>("Container");
ContainerCmp = CreateDefaultSubobject<UContainerCmp>("ContainerCmp");
}
Yeah I was sure I’ve had it working before, but after reading your post, I would think from memory I was using an ActorComponent. Well I got my program doing what I wanted as far as the code is concerned after a mammoth 14hours, 2 abondoned solutions and several expletives at the PC, so Im inclined to call it a day - if I have to use the drop down arrow on my container, and select edit, so be it.