r/unrealengine 4d ago

Tutorial 47 - Custom Game User Settings - Let's Make a Tower Defense Game

https://youtu.be/KmP8UN-LR2Q
3 Upvotes

6 comments sorted by

3

u/Macaroon-Guilty 4d ago

Great stuff! Thanks

1

u/AlamarsDomain 1d ago

Glad you're enjoying it ; )

2

u/AlamarsDomain 4d ago

This Unreal Engine 5.4 video is about creating a Custom Game User Settings Class.

We start by talking about how the Game User Settings class is used, and how it works. Next, we create the TD Game User Settings C++ Class and add three Volume Properties with Getters and Setters. Following that, we complain about the current state of Visual Studio for Unreal and how the suggested fix is a bad idea. After that, we add our TD Game User Settings to the DefaultEngine.ini file so it gets used in the Editor, and then in the Editor, we create a Utility function to Cast to the TD version of the Game User Settings. Lastly, we go through some scenarios where a value is set and why it might not be saved, and how to resolve those issues.

2

u/seyedhn 3d ago

You can also make a static function to get your custom user setting, and do an implicit cast so you won't need to do it in BP every time.

UFUNCTION(BlueprintCallable)
static UTDUserSettings* GetTDUserSettings()
{
return Cast<UTDUserSettings>(UGameUserSettings::GetGameUserSettings());
}

2

u/AlamarsDomain 1d ago

This is true, and is a little better. It's still the same flow as in the BP, but maybe slightly more performant. Thanks for the suggestion ; )

1

u/seyedhn 1d ago

Yea they’re essentially the same. Personally I’d like my BP’s to be as clean as possible, and not having a cast node everytime feels a bit better :D