How to get the Project Version in a blueprint?

Hello suitendaal,

The Project Settings (in your case the Genreal Project Settings; the Project ID, Project Name, Project Version, etc.) indeed get saved into the DefaultGame.ini inside your Projects Config folder, under the ‘[/Script/EngineSettings.GeneralProjectSettings]’ section inside the file.
But the Project Version is an exception, it only get’s saved into the INI file, if it differs to the Default ‘1.0.0.0’ from the Engine’s DefaultGame.ini (found inside the Engine’s config folder).
Which by itself is the default behavior, Unreal only saves differences from the ‘parent’ file. You can find the configuration file hierarchy here: Configuration Files | Unreal Engine Documentation .
If you want the Project Version to be saved into this config file, you basically have to change it to something else than ‘1.0.0.0’. If you want to retrieve that data, you can use the code given in the answer you linked in your question, but I’ll give it here again:

This goes inside the .h file

UFUNCTION(BlueprintCallable, meta = (DisplayName = "GetAppVersion"), Category = "Game Config")
static FString GetAppVersion();

One could replace the BlueprintCallable with the BlueprintPure tag making it a pure blueprint function. Which would make more sense as we’re not modifying anything. You can look at this article: Functions | Unreal Engine Documentation , for further details on pure vs impure functions.

And this goes into the .cpp file:

FString UVecherkaBPFunctionLibrary::GetAppVersion()
{
	FString AppVersion;
	GConfig->GetString(
		TEXT("/Script/EngineSettings.GeneralProjectSettings"),
		TEXT("ProjectVersion"),
		AppVersion,
		GGameIni
	);

	return AppVersion;
}

And don’t forget about the #include "CoreMinimal.h" otherwise the GConfig is not available to you.
Everything is placed inside a Blueprint Function Libary c++ class.

Hope that helps. Just let me know, if you have any questions.

Regards,

Vecherka.

Edit: Corrected the post and added references to it.

18 Likes