TikTok for Developers

开发者文档

上次更新时间:2026年11月13日

Initialize C# SDK

Initialize the SDK before calling any other API. The InitSDK call configures the runtime environment and must succeed before subsequent calls are made.

TT.InitSDK(callback)

Initializes the TikTok SDK for Unity. Call this method once when the game starts, before calling any other TT API.

Signature

public static void InitSDK(OnTTContainerInitCallback callback = null)

Parameters

Field

Type

Description

Required

callback

OnTTContainerInitCallback

Called when initialization finishes. Receives code (int) and env (ContainerEnv). A code of 0 means initialization succeeded.

No

Example

TT.InitSDK((code, env) =>
{
    if (code == 0)
    {
        // Continue initialization after the SDK is ready.
    }
});
TikTok for Developers