Пример #1
0
        private void Awake()
        {
            if (_instance == null)
            {
                _instance = this;
            }

            else if (_instance != this)
            {
                Destroy(gameObject);
            }

            DontDestroyOnLoad(gameObject);
        }
Пример #2
0
        /// <summary>
        /// Initialize SDK, must be called first.
        /// </summary>
        /// <param name="clientConfig">ClientConfig instance with configuration for IClient instance</param>
        /// <exception cref="UnsupportedPlatformException">Current platform is not supported</exception>
        public static void Initialize([CanBeNull] ClientConfig clientConfig = null)
        {
            if (_instance != null)
            {
                return;
            }
            if (clientConfig == null)
            {
                clientConfig = new ClientConfig();
            }

            var gameObject = new GameObject("Voximplant");

            _instance = gameObject.AddComponent <VoximplantSdk>();
            _instance.SetImplementation(Application.platform, clientConfig);
        }