private void Awake()
        {
            if (transform != transform.root)
            {
                throw new Exception("TinySauce prefab HAS to be at the ROOT level!");
            }

            _settings = Resources.Load <TinySettings>("TinySauce/Settings");
            if (_settings == null)
            {
                throw new Exception("Can't find TinySauce settings file.");
            }

            VoodooLog.Initialize(VoodooLogLevel.WARNING);
            if (_instance != null)
            {
                VoodooLog.LogW(Tag, "TinySauce is already initialized!. This object will be destroyed: " + gameObject.name);
                Destroy(gameObject);
                return;
            }

            _instance = this;
            DontDestroyOnLoad(this);

            // init TinySauce sdk
            InitFacebook();
            InitGameAnalytics();
            InitTenjin();
        }
        private void Awake()
        {
            if (transform != transform.root)
            {
                throw new Exception("TinySauce prefab HAS to be at the ROOT level!");
            }

            _sauceSettings = TinySauceSettings.Load();

            if (_sauceSettings == null)
            {
                throw new Exception("Can't find TinySauce sauceSettings file.");
            }

            if (_instance != null)
            {
                Destroy(gameObject);
                return;
            }

            _instance = this;
            DontDestroyOnLoad(this);

            VoodooLog.Initialize(VoodooLogLevel.WARNING);
            // init TinySauce sdk
            InitAnalytics();
        }
Esempio n. 3
0
        private void Awake()
        {
            #if UNITY_IOS
            NativeWrapper.RequestAuthorization((status) =>
            {
                InitFacebook();
            });
            #elif UNITY_ANDROID
            InitFacebook();
            #endif

            if (transform != transform.root)
            {
                throw new Exception("TinySauce prefab HAS to be at the ROOT level!");
            }

            _sauceSettings = TinySauceSettings.Load();
            if (_sauceSettings == null)
            {
                throw new Exception("Can't find TinySauce sauceSettings file.");
            }

            if (_instance != null)
            {
                Destroy(gameObject);
                return;
            }

            _instance = this;
            DontDestroyOnLoad(this);

            VoodooLog.Initialize(VoodooLogLevel.WARNING);
            // init TinySauce sdk
            InitAnalytics();
        }
        private void InitGameAnalytics()
        {
            VoodooLog.Log(Tag, "Initializing GameAnalytics");
            var gameAnalyticsInstance = FindObjectOfType <GameAnalytics>();

            if (gameAnalyticsInstance == null)
            {
                gameAnalyticsInstance = Instantiate(gameAnalyticsPrefab);
                gameAnalyticsInstance.gameObject.SetActive(true);
            }
            GameAnalytics.Initialize();
        }
 private static void InitTenjin()
 {
     VoodooLog.Log(Tag, "Initializing Tenjin");
     Tenjin.getInstance(TinySettings.tenjinApiKey).Connect();
 }
 private static void InitFacebook()
 {
     VoodooLog.Log(Tag, "Initializing Facebook");
     FB.Init(() => VoodooLog.Log(Tag, "Facebook Initialized"));
 }
 private void InitAnalytics()
 {
     VoodooLog.Log(TAG, "Initializing Analytics");
     AnalyticsManager.Initialize(_sauceSettings, true);
 }