Changing world gravity with custom C++ node in blueprints not working during runtime

Hi all–

I’ve implemented a custom blueprint node using C++ to set the world setting for global gravity z during runtime (following advice from numerous posts on here). I am wanting to update this value dynamically during runtime. I have got the script working to set the gravity on begin play using blueprints, but not to update continuously during gameplay. Debugging this shows that the global gravity value IS being set continuously, but does not appear to affect anything in game. Is this a limitation of the engine (i.e. gravity set only once on play) or an issue with my implementation? Thanks a lot for any advice.

WorldGravityModify.h

WorldGravityModify.cpp

Blueprint Construction Script

Blueprint event graph

I believe you need to set bGlobalGravitySet to true

Here is how I got it working to disable gravity.

#include "GameFramework/WorldSettings.h"

void ULimbsGameBPFL::DisableGravity(AWorldSettings* WorldSettings)
{
	if (!WorldSettings) return;

	WorldSettings->bGlobalGravitySet = true;
	WorldSettings->GlobalGravityZ = 0.f;
}