0
\$\begingroup\$

I've derived GameUserSettings to add a bunch of custom properties to it. I tried making accessible in blueprint by creating a static method that returns the current GameUserSettings cast to my Child Class.

 Custom_Settings * Custom_Settings::GetCustom_Settings() {
     return Cast<Custom_Settings>(GEngine->GameUserSettings);
 }

Unforunately, the cast fails and returns null, which leads to UE complaining about trying to access none in blueprint (naturally). There was a similar question here, but that led me nowhere, since I've already set DefaultEngine.ini to use my custom settings

 [/Script/Engine.Engine]
 GameUserSettingsClassName=/Script/MyGame.Custom_Settings

I've checked whether GEngine can fetch the Settings, and it appears it can. Does anybody have an idea why the cast might be failing?

\$\endgroup\$
  • \$\begingroup\$ Well UE4 is known to not pick up things from the *.ini files. You can try to subclass the GEngine class - this one is known yo work and make it work with you Custom_Settings class \$\endgroup\$ – ColdSteel Nov 9 '19 at 14:19
  • \$\begingroup\$ Just for convinience please show how you declare your custom class \$\endgroup\$ – ColdSteel Nov 9 '19 at 14:20
0
\$\begingroup\$

After trying all manner of things, deleting the .vs, Binaries, Intermediate, Saved and .sln, rebuilding the VS Files and building the project from there turned out to solve this problem.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.