Hey there,
In C++, we may write the following:
#if !UE_BUILD_SHIPPING
// lalala
#endif
Is there an equivalent node for blueprints? Or how can we determine if a game is in shipping/debug/test mode??
Hey there,
In C++, we may write the following:
#if !UE_BUILD_SHIPPING
// lalala
#endif
Is there an equivalent node for blueprints? Or how can we determine if a game is in shipping/debug/test mode??
It’s an older question, but I managed to solve it this way:
But, this “Get Build Configuration” node does not exist, you’ll need to create a C++ class (parent: blueprint function) and add the following code to it (the following code is my code, change your (function) names accordingly)
GetBuildConfiguration.h
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "GetBuildConfiguration.generated.h"
/**
*
*/
UCLASS()
class SPEEDRUNNER_API UGetBuildConfiguration : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
UFUNCTION(Category = "Utility", BlueprintCallable)
// Return to blueprint node
static void GetBuildConfiguration(FString& Configuration);
};
GetBuildConfiguration.cpp
#include "GetBuildConfiguration.h"
void UGetBuildConfiguration::GetBuildConfiguration(FString& Configuration)
{
#if !UE_BUILD_SHIPPING
#if WITH_EDITOR
Configuration = "TEST";
#else
Configuration = "DEVELOPMENT";
#endif // WITH_EDITOR
#else
Configuration = "SHIPPING";
#endif
}
Still no built in BP node for this ? Strange…
How are we supposed to manage this ?
For example in my case I have variable for dev only. How to be sure they won’t be used in shipping ?
Update Q4 2023
There is now a Blueprint node called Get Build Configuration
(from UKismetSystemLibrary
).
But, it’s still probably better to do things in C++ with the macros (UE_BUILD_SHIPPING
for example) since that way you can strip away code at compile-time. This has several benefits:
#if ... #endif
gets ignored by the compiler. So less code is generated.It’s a very common thing when building games to use these, commonly for logging and error handling, but also for disabling tools that are only needed during development.