I Am new to the Engine, I discovered that i can have a Reference to a class in C++ and then assign it from the editor as long as it is in the level.
So the Question is how can i do the same for components in the Blueprint like having a UPROPERTY for UBoxComponent And then from the inherited Blueprint add a box Component and tell that variable that box is what are you referencing
Just do it in Blueprint? Right click, type set <name of the uproperty var>
.
If you added a UBoxComponent
to the Blueprint, just use the construction or begin play to set the UPROPERTY
.
Here my BP_FollowCamera
is a Blueprint class inherited from a C++ FollowCamera
class.
Camera Confines is a UPROPERTY
:
/**
* Box containing the limits for the camera. Camera viewport must be contained
* within this volume.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="FollowCamera")
UBoxComponent *CameraConfines;
In the screenshot I have used the BeginPlay event in the Blueprint subclass to set the camera confines variable to be assigned a new UBoxComponent
The BlueprintAddedBox
is one I added from the Components + Add
menu. (Though it makes no sense to do that, I just made this change to illustrate for this question).
Thanks a lot — that actually helps! Instead of using the “search components by tag” approach, I think this is much more organized.
1 Like