I declared a Macro to remove some of the boilerplate code that comes with declaring components. Here’s the Macros:
#define DECLARE_COMPONENT(TYPE,NAME) \
private: \
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Draco|Character", Meta = (AllowPrivateAccess = "true")) \
TObjectPtr<TYPE> NAME;
#define DECLARE_GETTER(TYPE,NAME) \
public: \
FORCEINLINE TYPE* Get##NAME##() const { return NAME; }
#define DECLARE_COMPONENT_WITH_GETTER(TYPE,NAME) \
DECLARE_COMPONENT(TYPE,NAME) \
DECLARE_GETTER(TYPE,NAME)
When I use it like this:
DECLARE_COMPONENT_WITH_GETTER(UCameraComponent, CameraComponent)
And create a blueprint of the c++ class, here’s how the component looks like in blueprint:
Is this expected?