Does saving of custom AWorldSettings work?

Can custom world settings be saved with the level (umap)?

We would like to store some additional information to levels and AWorldSettings seems like a good place to store this data. We have extended a new class from AWorldSettings and set the Project Settings → Engine → Default Classes → World Settings Class to point to this new class.

By doing this we now can change custom UPROPERTY parameters using the World Settings tab, but these settings are not saved. Every time new level is loaded, settings are reset to defaults. Also every time UE4Editor is closed, all custom settings are lost.

There is not much information in the documentation and I have skimmed through the AWorldSettings source code, but didn’t really find anything suspicious.

If anyone know how this thing is supposed to work, that would make my day…

Here is the source code we currently have. The Gold Drop Rate parameter is shown in World Settings and can be edited, but it is not saved when level is saved:

UCLASS(Blueprintable, BlueprintType)
class XXX_API ACustomWorldSettings : public AWorldSettings
{
	GENERATED_BODY()
	
public:


protected:

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "xxx", meta = (AllowPrivateAccess = "true"))
	float gold_drop_rate;	
};

In my project, it works well. my engine version is 4.18.1

World Settings are saved in the level same as level blueprint, so if you load new level you gonna have settings of that level, you will need to set that value for each level or else default will be used.

Only potential issue for saving i can see is fact you using protected, is there any reason why you doing so? Because it seems kind of pointless, not to mention you won’t be able to access that value in C++ by doing so.

Also you using uncoventional naming format UE4, by UE4 convention you should format name like this GoldDropRate, but i don’t think this can cause any saving issue but who knows.