About FalconMain.Init and Init SDK

With the new SDK, SDK initialization will be done automatically in Unity at the step before scene loading, using Attribute:

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]

Details of the above attribute of Unity are available here.

In addition, FalconMain provides the following call functions:

1. FalconMain.InitState

Provides information about the initialization status of FalconMain, including 4 basic states:

  • NotStarted

  • Processing

  • Succeed

  • Failed

2. FalconMain.OnInitComplete

An event callback for successful SDK initialization.

As mentioned above, the SDK is instantiated automatically before the first scene in Unity loads, so if you want to assign an event, you also need to use the RuntimeInitializeOnLoadMethod attribute with the RuntimeInitializeLoadType before BeforeSceneLoad.

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
static void OnBeforeSplashScreen()
{
    FalconMain.OnInitComplete += ((sender, args) => 
        Debug.Log("This log will be print right after FalconSDK initialization <3"));
}

This EventHandler will be called in the MainThread right after the FalconMain Init is complete.

3. In case you want to Init Manually

When you want to manually Init SDK, you need to remove the RuntimeInitializeOnLoadMethod attribute from FalconMain.Init, and then manually call the FalconMain.Init function in the code (note that the function must be called in the main thread)

Last updated