I’ve followed the tutorial:
and done all the steps, now I’m on my own.
But I still don’t understand ‘Why’ the C++ values I set is not being updated to the existing objects
in Unreal Editor?
If I make a Blueprint, all the existing objects update their value accordingly.
Example is:
USpringArmComponent* springArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("MyCameraAttach"));
springArm->SetupAttachment(RootComponent);
springArm->SetRelativeRotation(FRotator(-50, 0, 0));
springArm->TargetArmLength = 300.0f;
springArm->bEnableCameraLag = true;
springArm->bEnableCameraRotationLag = true;
springArm->CameraLagSpeed = 30.0f;
If I change the Rotator values, or TargetArmLength, the existing objects keeps their values. They don’t update to the new values. Unless I create new objects of the C++ class. Or as written above, create a blueprint out of the C++ class, put out objects made out of Blueprint, then change the values (and of course, expose USpringArmComponent as a UPROPERTY(EditAnywhere))
I don’t want to be able to change those values in Editor or Blueprint so it’s not a UProperty. I want it to be hardcoded in C++ side as I’m still learning. As you can see in the code above, it’s a local variable that just attaches itself to RootComponent.
I’ve also tried to use ‘PostInitProperties’ but it did not help.
Apparently though, changing my Static Mesh asset updates all the existing objects (which is also in the C++ side).
So how come my SpringArmComponent is not being updated?
Or is this intended?
EDIT:
I work by opening Unreal project first, and then opening Visual Studios.
So I do not upen the Unreal Editor by building it from Visual Studios.
Also, I usually build the Visual Studios project, rather than compiling it from Unreal Editor.
But compiling from Editor doesn’t seem to make any difference, other than that I have to use the mouse, instead of just using the Hotkey CTRL + B in Visual Studios.