Show properties of subclass directly inside of component

I have an custom Movement Component attached to a Pawn class.

Inside the Movement Component I have structs for basic configuration of a helicopter.
For the rotors I have a rotor class which is a member of Movement Component.

The structs getting displayed as desired. But the Tailrotor properties only show the rotorclass and all properties of the rotorclass can be edited by the Property-Editor in a separate window.

Is it possible to display the properties of the rotor class inside the Movement Component property-pane directly like the one’s coming from structs?

249588-aaa.png

Tail Rotor properties should be displayed like the one for Main Rotor. I have used struct and class here just for demonstration.

HelicopterMovementComponent.h

#include "CoreMinimal.h"
#include "GameFramework/PawnMovementComponent.h"
#include "Curves/CurveFloat.h"
#include "HelicopterMovementComponent.generated.h"

class URotor;

USTRUCT()
struct SAR_API FHelicopterEngine
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, Category=Engine)
	bool EngineStarted;
};

USTRUCT()
struct SAR_API FHelicopterSetup
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, Category=HelicopterSetup)
	float Mass;

	UPROPERTY(EditAnywhere, Category=HelicopterSetup)
	FVector COG;
};

USTRUCT()
struct SAR_API FAirfoil
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, Category=Airfoil)
	FName Name;

	UPROPERTY(EditAnywhere, Category=Airfoil)
	FRuntimeFloatCurve LiftCurve;

	UPROPERTY(EditAnywhere, Category=Airfoil)
	FRuntimeFloatCurve DragCurve;
};

USTRUCT()
struct SAR_API FRotorSetup
{
	GENERATED_USTRUCT_BODY()

	// Number of blades attachted to this rotor.
	UPROPERTY(EditAnywhere, Category=RotorSetup)
	int BladeCount;

	// Rounds per minute of this rotor during operation.
	UPROPERTY(EditAnywhere, Category=RotorSetup)
	int RPM;

	// Blade length.
	UPROPERTY(EditAnywhere, Category=RotorSetup)
	float Length;

	// Blade width.
	UPROPERTY(EditAnywhere, Category=RotorSetup)
	float Width;

	UPROPERTY(EditAnywhere, Category=RotorSetup)
	FAirfoil Airfoil;

	// Additional offset to give the rotor.
	UPROPERTY(EditAnywhere, Category=RotorSetup)
	FVector AdditionalOffset;

	FRotorSetup();
};


/**
 * 
 */
UCLASS()
class SAR_API UHelicopterMovementComponent : public UPawnMovementComponent
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, Category=RotorSetup)
	FRotorSetup MainRotor;

	UPROPERTY(EditInstanceOnly, Category=RotorSetup)
	URotor* TailRotor;

	UPROPERTY(EditAnywhere, Category=HelicopterSetup)
	FHelicopterSetup HelicopterSetup;

	UPROPERTY(EditAnywhere, Category=Engine)
	FHelicopterEngine Engine;

public:
	UHelicopterMovementComponent();
};

Rotor.h

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "Rotor.generated.h"

/**
 * 
 */
UCLASS()
class SAR_API URotor : public UObject
{
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere, Category=Rotor)
	int BladeCount;

	UPROPERTY(EditAnywhere, Category=Rotor)
	float BladeLength;

	UPROPERTY(EditAnywhere, Category=Rotor)
	float BladeWidth;

	UPROPERTY(EditAnywhere, Category=Rotor)
	int MaxRPM;

	UPROPERTY(EditAnywhere, Category=Rotor)
	int RPM;

	UPROPERTY()
	float Azimut;
};
1 Like

There “Instanced” specifier which let you do that, but first you need to create default sub object in constructor same as you add component to actor

1 Like

Thanks mate, that solved my issue. You rock!

1 Like