public static void OnSettingsEnabled(WeaverSettings settings) { if (AnalyticState.IsFirstLaunchOnMachine) { SendEvent("User", "FirstLaunch", "", null); } if (AnalyticState.IsNewSession()) { SendEvent("User", "HasPro", InternalEditorUtility.HasPro().ToString(), null); SendEvent("User", "ScriptCount", AssetDatabase.FindAssets("t:Script").Length.ToString(), null); } }
/// <summary> /// Creates a new state if one does not exist and populates it /// with any information that we stored in editor prefs. /// </summary> public static void LoadState() { if (_instance == null) { _instance = new AnalyticState(); } if (EditorPrefs.HasKey(AnalyticsConstants.STATE_EDITOR_PREFS_KEY)) { string json = EditorPrefs.GetString(AnalyticsConstants.STATE_EDITOR_PREFS_KEY); if (!string.IsNullOrEmpty(json)) { JsonUtility.FromJsonOverwrite(json, _instance); } } }