[request] Access Developer Settings in BP

It’s great we can create our own Project Settings by extending DeveloperSettings. Very easy to use it in C++.

But… we can’t get reference to our custom settings in blueprint. Every time someone wants to read value in blueprint/UMG, programmers needs to add extra getter to C++ function library.

It would be awesome if we could get reference to Project Settings (especially our custom Developer Settings) from blueprints. And thanks to that we could easily read all the values we want. Is that possible? :slight_smile:

I use this in developer settings to have easy access to variables from both BP and C++:

 .h

static UCH_DeveloperSettings* Get();

UPROPERTY( EditAnywhere, config, Category = "Server API" )
FString API_URL = "Hello";

UFUNCTION( BlueprintPure, Category = "Server API" )
static FString GetApiURL()
{
    return UCH_DeveloperSettings::Get()->API_URL;
}


.cpp

UCH_DeveloperSettings* UCH_DeveloperSettings::Get()
{
	static UCH_DeveloperSettings* Instance;

	if(Instance != nullptr)
	{
		return Instance;
	}

	for (TObjectIterator<UCH_DeveloperSettings> SettingsIt(RF_NoFlags); SettingsIt; ++SettingsIt)
	{
		Instance = *SettingsIt;
		break;
	}

	return Instance;
}

Yes, I know I can add a function for every property. I’m doing this now :wink:
I’d like to have access to all blueprint exposed properties without additional getter. Like with properties of object or struct :slight_smile:

For those that would like to know how to achieve this : use the node “GetClassDefaults” and choose your DeveloperSettings class. Make sure to mark properties with “BlueprintReadOnly”

3 Likes

Thanks man

i’d also would like to have this in the engine.

ive exposed a static function that returns the instance of the settings. not sure how well this works.