/// <summary> /// Initializes the Poly Toolkit runtime API. This will be called by PolyToolkitManager on its Awake method, /// you shouldn't need to call this method directly. /// </summary> public static void Init(PolyAuthConfig?authConfig = null, PolyCacheConfig?cacheConfig = null) { // NOTE: although it might seem strange, we have to support the use case of re-initializing PolyApi // (with possibly different config) because that's what happens when the project goes from play // mode back to edit mode -- the Poly Toolkit editor code will call PolyApi.Init with the editor // config, and in that case we should wipe out our previous state and initialize again. Shutdown(); PtSettings.Init(); PolyMainInternal.Init(authConfig, cacheConfig); Authenticator.Initialize(authConfig ?? PtSettings.Instance.authConfig); initialized = true; }
/// <summary> /// Shuts down the Poly Toolkit runtime API. Calling this method should not normally be necessary /// for most applications. It exists for some very specific use cases, such as writing an editor /// extension that needs to have precise control over initialization and deinitialization of /// components. /// </summary> public static void Shutdown() { if (PolyMainInternal.IsInitialized) { PolyMainInternal.Shutdown(); } if (Authenticator.IsInitialized) { Authenticator.Shutdown(); } initialized = false; }