Config saving issue

Hello,

By following the directions in the documentation, I’m trying to save a config file.

Editing manually DefaultGame.ini allowed me to add this setting:

[/Script/Haven.HavenBuildGun]
RotationStep=10

which works wonderfully.

But saving… it doesn’t work (wait, this isn’t the bug, but I think the bug prevents saving!)

My setup has this info:

UCLASS(Config="Game") // I tried this both with and without quotes
class HAVEN_API AHavenBuildGun : public AHavenWeapon
{
	GENERATED_BODY()

	AHavenBuildGun(const FObjectInitializer& ObjectInitializer);

protected:
	UPROPERTY(Config)
	uint8 RotationStep;

// A bunch of other stuff here
}

And in the primary fire function, for testing:

void AHavenBuildGun::HandlePrimaryFiring()
{
	RotationStep = 1;
	SaveConfig();
    // More stuff here
}

So, my class setup defines that the files will be saved to Game.ini file.
When I set breakpoints, inside the SaveConfig() function, there’s this block of code:

const FString Filename
// if a filename was specified, always load from that file
=	InFilename
	? InFilename
	: GetConfigFilename(this);

When inspecting the GetConfigFilename() function, it seems it always returns Engine, thus, causing the value of Filename to be

+		Filename	L"E:/Zoc_Haven_Workspace/Haven/Saved/Config/Windows/Engine.ini"	FString

I’m a bit tired, but as far as I could inspect it, this is how it goes. The Game.ini never gets saved, and the variable isn’t saved into Engine.ini.

Thank you in advance, hopefully this can be easily solved :smiley:


Update (2015-07-23) as requested by Eric (I am holding my breath to avoid making a Pokemon joke! Sorry! :x )

Branch: Unreal Engine 4.8.2, as downloaded from Epic Games Launcher

Build Version: 4.8.2-2614606+++depot+UE4-Releases+4.8

I think that’s it. Please, tell me if you need any extra information :slight_smile:

Hi Zoc -

Thank you for your report. We have assigned this issue to a member of our support staff, and they will begin investigation as soon as possible. If we are unable to reproduce the issue, or we need additional information, our staff member will comment here with additional questions. Otherwise, we will post an ‘Answer’ once we have logged the issue in our bug database or we have a solution for it.

In the meantime, please be sure to review our suggestions for how to report a bug, and feel free to edit your post if you have additional information to provide:

Thank you -

Eric Ketchum

Hi Zoc,

You’re using the function in the correct way, but are you calling the function that calls SaveConfig()? I copied your code verbatim (omitting a few things for different file names.) I then created a blueprint (aptly named ‘NewBlueprint’) in the editor based off this class and with HandlePrimaryFiring being called on BeginPlay(). After placing an instance of this blueprint in the level and hitting Play, I checked my Game.ini file and had the following inside of it:

[/Game/NewBlueprint.NewBlueprint_C]
RotationStep=1

Can you make sure that the function is being called, or simply try calling SaveConfig on BeginPlay() or on Tick()?

Sure thing. Here is a project for 4.8.2 where the saving works correctly. You’ll need to generate project files and then build, as I deleted unnecessary things to make the project fit. After that, you should be able to check the Game.ini after launching the project to see that it is blank. If you then open the ‘untitled’ map and hit Play, the Game.ini should be populated with the saved data.

Hello ,

Thanks for looking at this issue!

I’m pretty sure that I’m calling the function, because I set a few breakpoints and was able to both debug the SaveConfig() function and find that Filename variable was getting the wrong path/file in it’s value.

One thing that I noticed is that you used a blueprint to trigger the save. Maybe that was what was different from my calls?

I’ll try in a minute to call SaveConfig() from BeginPlay().

Btw, if you haven’t deleted your test project, I’d love to take a look at it to see if I can spot any difference in the process.

Thanks in advance! I’ll get back to you after a phone call I need to make right now :slight_smile: