I have a multi-wheeled vehicle I’m trying to code in c++. The idea is to have the meaty parts coded in c++ and use a BP wrapper to specify the static mesh components that make up the vehicle. Right now, I can specify the main chassis static mesh component just fine. The tricky part is the chassis can a variable number of wheels. What needs to happen is for the BP to accept a drag/drop from the content browser which allows the wheel’s static mesh to be selected and passed to the c++ parent of the BP. The c++ code will then add the wheels as subcomponents to the chassis as needed when the actor is spawned. I have this declaration in the header file:
UPROPERTY(VisibleDefaultsOnly, Category = MyVehicle)
However, the editor rejects attempts to drag a static mesh from the content browser into the BP for this variable. (Entry box turns red.)
I know the usual way is to hard code the model. For example:
static ConstructorHelpers::FObjectFinder<UStaticMesh> SomeMesh(TEXT(“StaticMesh’/Game/Models/TheMesh.TheMesh’”));
But I’d like to avoid that to allow some flexibility. What’s the trick to do this?