# 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](https://docs.unity3d.com/ScriptReference/RuntimeInitializeOnLoadMethodAttribute.html).

In addition, FalconMain provides the following call functions:&#x20;

## 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 (<mark style="color:red;">note that the function must be called in the main thread</mark>)&#x20;

<figure><img src="https://1219926239-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjXDVMhWRiIUCExjfRIcD%2Fuploads%2FGn15mbP0giOnDUIKIb21%2Fimage.png?alt=media&#x26;token=ee6d7466-6328-4af0-b35f-f0ab02f78e41" alt=""><figcaption></figcaption></figure>
