Function Libraries🔗

Interacting with unreal from scripts often happens through function libraries. These are exposed to script as namespaces containing a set of related functions.

For example, to set a timer you can call System::SetTimer():

class ATimerExample : AActor
{
    UFUNCTION(BlueprintOverride)
    void BeginPlay()
    {
        // Execute this.OnTimerExecuted() after 2 seconds
        System::SetTimer(this, n"OnTimerExecuted", 2.0, bLooping = false);
    }

    UFUNCTION()
    private void OnTimerExecuted()
    {
        Print("Timer executed!");
    }
}

Common Libraries🔗

Clicking the library will bring you to the API documentation for them, listing the available functions:

Namespace Simplification🔗

The functions for function libraries in script are automatically taken from blueprint function library classes in C++.

Before binding, the angelscript plugin simplifies the name of the class to make a shorter namespace. For example, the functions in the System:: namespace are automatically sourced from the UKismetSystemLibrary class in C++.

Common prefixes and suffixes that get stripped automatically are:

For some examples of how namespaces are simplified:

Math Library🔗

Because blueprint and C++ have fairly different ways of doing math code, we have decided to keep the Math:: namespace in script closer to the C++ FMath:: namespace in general.

Sticking closer to C++ math eases the transition for experienced programmers and lets code be ported between the two more easily.

This means that UKismetMathLibrary gets ignored for automatic binding.