C++ Reference
Call the Scooter Utilities runtime library from your own C++ code.
Every Scooter Utilities Blueprint node is a static function on a Blueprint function library class in the ScooterUtilsBPLibraryModule runtime module. Add the module as a dependency and you can call those same functions from C++, plus a couple of C++-only extras for debug logging.
Setting Up Your Module
Make sure the plugin is installed and enabled in your project. See Installing and Enabling.
In your module's
.Build.csfile, addScooterUtilsBPLibraryModuleto your dependencies:csharpPrivateDependencyModuleNames.AddRange(new string[] { "ScooterUtilsBPLibraryModule" });Use
PublicDependencyModuleNamesinstead if your module's public headers include Scooter Utilities headers.If your code lives in another plugin, list Scooter Utilities as a dependency in that plugin's
.upluginfile:json"Plugins": [ { "Name": "ScooterUtils", "Enabled": true } ]Include the header for the class you want to call, then call its static functions. You never need to create an instance.
TIP
The module name is ScooterUtilsBPLibraryModule, not the ScooterUtilsBPLibrary folder name under Source.
Headers and Classes
| Header | Class | Description |
|---|---|---|
DebugPrint.h | USUDebugPrint | Timestamped logging to the Output Log and log files, plus the SCOOTER_DEBUG_PRINT macro. See Debug Print. |
FileIO.h | UFileIO | Load, save, and append text files. See File IO. |
ScooterUtilsBPLibrary.h | UScooterUtilsBPLibrary | Read and write config values. See Global Config. |
BPReflection.h | UBPReflection | Name and path information for an object's Blueprint. See Blueprint Reflection. |
LoremIpsumGenerator.h | ULoremIpsumGenerator | Placeholder text. See Lorem Ipsum. |
JSONBlueprintLibrary.h | UJSONBlueprintLibrary | String-based JSON creation and parsing. See JSON. |
The runtime module is set up for Windows, macOS, Linux, and Android, and works in packaged games as well as in the editor.
Quick Example
A small actor that logs a message, builds some JSON, and saves it to the project's Saved folder:
// MyActor.cpp
#include "MyActor.h"
#include "DebugPrint.h"
#include "FileIO.h"
#include "JSONBlueprintLibrary.h"
void AMyActor::BeginPlay()
{
Super::BeginPlay();
SCOOTER_DEBUG_PRINT(TEXT("MyGame.log"), EDebugLevel::Info, TEXT("%s started"), *GetName());
FString Json;
Json = UJSONBlueprintLibrary::AddField(EJSONFieldType::String, Json, TEXT("actor"), GetName());
Json = UJSONBlueprintLibrary::AddField(EJSONFieldType::Boolean, Json, TEXT("started"), TEXT("true"));
FString SavedPath;
UFileIO::SaveTextToFile(EFileLocation::ProjectSaved, TEXT("ActorState.json"), Json, SavedPath);
}