Cesium for Unreal 2.12.0
|
It can be a challenge to develop a UObject-derived class that can be used from C++, from Blueprints, and in the Editor while ensuring internal states stay consistent. Here are some tips:
VisibleAnywhere
or EditAnywhere
depending on whether the property is read-only or editable in the Details panel in the Editor. Or omit both of these if it should not show up in the Editor at all.BlueprintReadOnly
or BlueprintReadWrite
depending on whether the property is read-only or editable from Blueprints. Or omit both of these if it should now be accessible from Blueprints at all.PostEditChangeProperty
method to be notified of changes to UPROPERTY values in the Editor.BlueprintSetter
attribute to each property to be notified of changes to UPROPERTY values from Blueprints.private:
section of the class and have Meta = (AllowPrivateAccess)
. This prevents them from being get/set directly from C++ code outside the class, which is important because there is no mechanism like PostEditChangeProperty
or BlueprintSetter
available from C++ code.public:
section. Such a property probably doesn't need a PostEditChangeProperty
or BlueprintSetter
either.BlueprintSetter
must be a UFUNCTION. This function should usually be public and it should be the mechanism for setting the property from C++, too. A corresponding BlueprintGetter
is usually needed for use by C++ even though it's often not needed for Blueprints.