void OnEnable()
        {
            EditorApplication.hierarchyWindowItemOnGUI += GameAnalytics.HierarchyWindowCallback;

            if(Application.isPlaying)
                _instance = this;
        }
		public void Awake()
		{
			if(!Application.isPlaying)
				return;
			
			if(_instance != null)
			{
				// only one system tracker allowed per scene
				Debug.LogWarning("Destroying dublicate GameAnalytics object - only one is allowed per scene!");
				Destroy(gameObject);
				return;
			}
			_instance = this;

			DontDestroyOnLoad(gameObject);

			#if (UNITY_4_9 || UNITY_4_8 || UNITY_4_7 || UNITY_4_6 || UNITY_4_5 || UNITY_4_3 || UNITY_4_2 || UNITY_4_1 || UNITY_4_0_1 || UNITY_4_0 || UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_2 || UNITY_3_1 || UNITY_3_0_0 || UNITY_3_0 || UNITY_2_6_1 || UNITY_2_6)
			Application.RegisterLogCallback(GA_Debug.HandleLog);
			#else
			Application.logMessageReceived += GA_Debug.HandleLog;
			#endif

			Initialize();
		}
        void OnDestroy()
        {
            if(!Application.isPlaying)
                return;

            if(_instance == this)
                _instance = null;
        }
        // Token: 0x06000168 RID: 360 RVA: 0x0000B260 File Offset: 0x00009660
        private static void Initialize()
        {
            if (!Application.isPlaying)
            {
                return;
            }
            if (GameAnalytics.SettingsGA.InfoLogBuild)
            {
                GA_Setup.SetInfoLog(true);
            }
            if (GameAnalytics.SettingsGA.VerboseLogBuild)
            {
                GA_Setup.SetVerboseLog(true);
            }
            int platformIndex = GameAnalytics.GetPlatformIndex();

            GA_Wrapper.SetUnitySdkVersion("unity " + Settings.VERSION);
            GA_Wrapper.SetUnityEngineVersion("unity " + GameAnalytics.GetUnityVersion());
            if (platformIndex >= 0)
            {
                GA_Wrapper.SetBuild(GameAnalytics.SettingsGA.Build[platformIndex]);
            }
            if (GameAnalytics.SettingsGA.CustomDimensions01.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions01(GameAnalytics.SettingsGA.CustomDimensions01);
            }
            if (GameAnalytics.SettingsGA.CustomDimensions02.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions02(GameAnalytics.SettingsGA.CustomDimensions02);
            }
            if (GameAnalytics.SettingsGA.CustomDimensions03.Count > 0)
            {
                GA_Setup.SetAvailableCustomDimensions03(GameAnalytics.SettingsGA.CustomDimensions03);
            }
            if (GameAnalytics.SettingsGA.ResourceItemTypes.Count > 0)
            {
                GA_Setup.SetAvailableResourceItemTypes(GameAnalytics.SettingsGA.ResourceItemTypes);
            }
            if (GameAnalytics.SettingsGA.ResourceCurrencies.Count > 0)
            {
                GA_Setup.SetAvailableResourceCurrencies(GameAnalytics.SettingsGA.ResourceCurrencies);
            }
            if (GameAnalytics.SettingsGA.UseManualSessionHandling)
            {
                GameAnalytics.SetEnabledManualSessionHandling(true);
            }
            if (platformIndex >= 0)
            {
                if (!GameAnalytics.SettingsGA.UseCustomId)
                {
                    GA_Wrapper.Initialize(GameAnalytics.SettingsGA.GetGameKey(platformIndex), GameAnalytics.SettingsGA.GetSecretKey(platformIndex));
                }
                else
                {
                    Debug.Log("Custom id is enabled. Initialize is delayed until custom id has been set.");
                }
            }
            else
            {
                Debug.LogWarning("GameAnalytics: Unsupported platform (events will not be sent in editor; or missing platform in settings): " + Application.platform);
            }
        }
Example #5
0
 public static string GetCommandCenterValueAsString(string key)
 {
     return(GameAnalytics.GetCommandCenterValueAsString(key, (string)null));
 }