UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = CameraHeight, meta = (AllowPrivateAccess = true))
class UDataTable* DT_CameraHeight;
I want to get the float variable Height and set its value to another variable. Height = NewHeight;
I don’t want to change the values in data table, but I want to read them and assign them to another variable.
in my case, the float type variable Height is defined under the data table with the value 100
and I want to assign this value 100 to another variable NewHeight , so Newheight = 100
I don’t want to change the values in data table, but I want to read them and assign them to another variable.
in my case, the float type variable Height is defined under the data table with the value 100
and I want to assign this value 100 to another variable NewHeight, so Newheight = 100
Ok, thank You, I will try it once my engine build completed, for some reason it starts rebuilding the engine… I mistakenly starts typing in the engine.h file, and quickly undo the changes, started to build the project and now the engine want to be build it will take 1 hour.
Finally I managed to re-Install and rebuild the engine from source, Just tested your example and it works perfectly but only with pointer and direct assignment seems to be not finding the data table.
Now it looks like this in my code according to your pointer version example and working:
if (const UDataTable* DT_CameraHeight{ LoadObject<UDataTable>(GetWorld(), TEXT("DataTable'/Game/Datasbase/DataTables/Camera/DT_CameraHeight.DT_CameraHeight'")) })
{
if (const FST_CameraHeight* Row{ DT_CameraHeight->FindRow<FST_CameraHeight >("Crouch_Normal_Move", "") })//character camera position should change according to the pose.
{
NewHeight = Row->Height;
printf("The new value of NewHeight is: %f", NewHeight);
}
}
else
{
printf("The value for NewHeight has not been modified: %f", NewHeight);
}
so, printf(“The new value of NewHeight is: %f”, NewHeight); prints the value assigned from Height
This is just an amazing approach in my learning process and thank you very much bro for helping me out.