Inheritance: MonoBehaviour
Exemple #1
0
    public void Start()
    {
        _systemTracker = GetComponent<GA_SystemTracker>();

        SceneChange();
        StartCoroutine(SubmitFPSRoutine());
    }
	void OnEnable ()
	{
		EditorApplication.hierarchyWindowItemOnGUI += GA.HierarchyWindowCallback;
		
		if (Application.isPlaying)
			GA_SYSTEMTRACKER = this;
	}
Exemple #3
0
    void OnEnable()
    {
        EditorApplication.hierarchyWindowItemOnGUI += GA.HierarchyWindowCallback;

        if (Application.isPlaying)
        {
            GA_SYSTEMTRACKER = this;
        }
    }
Exemple #4
0
    void OnDestroy()
    {
        if (!Application.isPlaying)
        {
            return;
        }

        if (GA_SYSTEMTRACKER == this)
        {
            GA_SYSTEMTRACKER = null;
        }
    }
	public void Awake ()
	{
		if (!Application.isPlaying)
			return;
		
		if (GA_SYSTEMTRACKER != null)
		{
			// only one system tracker allowed per scene
			GA.LogWarning("Destroying dublicate GA_SystemTracker - only one is allowed per scene!");
			Destroy(gameObject);
			return;
		}
		GA_SYSTEMTRACKER = this;
	}
Exemple #6
0
    public void Awake()
    {
        if (!Application.isPlaying)
        {
            return;
        }

        if (GA_SYSTEMTRACKER != null)
        {
            // only one system tracker allowed per scene
            GA.LogWarning("Destroying dublicate GA_SystemTracker - only one is allowed per scene!");
            Destroy(gameObject);
            return;
        }
        GA_SYSTEMTRACKER = this;
    }
    // ----------------------------------------------------------------------
    // GA - http://support.gameanalytics.com/hc/en-us/articles/200841396-Tips#customArea

    public void gameAnalyticsInit()
    {
        if (analyticsGameAnalytics == null)
        {
            analyticsGameAnalytics = FindObjectOfType(typeof(GA_SystemTracker)) as GA_SystemTracker;

            if (!analyticsGameAnalytics)
            {
                var obj = new GameObject("_analyticsGameAnalytics");
                analyticsGameAnalytics = obj.AddComponent <GA_SystemTracker>();
                DontDestroyOnLoad(analyticsGameAnalytics);
            }
        }

        //analyticsEveryplay.clientId = AppConfigs.analyticsEveryplayClientId;
        //analyticsEveryplay.clientSecret = AppConfigs.analyticsEveryplayClientSecret;
        //analyticsEveryplay.redirectURI = AppConfigs.analyticsEveryplayAuthUrl;
    }
    /// <summary>
    /// Setup involving other components
    /// </summary>
    public void Start()
    {
        if (!Application.isPlaying)
            return;

        if (GA_SYSTEMTRACKER != null)
        {
            // only one system tracker allowed per scene
            GA.LogWarning("Destroying dublicate GA_SystemTracker - only one is allowed per scene!");
            Destroy(gameObject);
            return;
        }
        GA_SYSTEMTRACKER = this;

        if (UseForSubsequentLevels)
            DontDestroyOnLoad(gameObject);

        GA_Gui gui = GetComponent<GA_Gui>();
        gui.GuiAllowScreenshot = GuiAllowScreenshot;
        gui.GuiEnabled = GuiEnabled;

        GA.API.Debugging.SubmitErrors = SubmitErrors;
        GA.API.Debugging.SubmitErrorStackTrace = SubmitErrorStackTrace;
        GA.API.Debugging.SubmitErrorSystemInfo = SubmitErrorSystemInfo;
        GA.API.Debugging.MaxErrorCount = MaxErrorCount;

        if(GA.API.Debugging.SubmitErrors) //Warning this registerLogCallback is slow because it saves the stacktraces
            Application.RegisterLogCallback(GA.API.Debugging.HandleLog);

        // Add system specs to the submit queue
        if (IncludeSystemSpecs)
        {
            List<Hashtable> systemspecs = GA.API.GenericInfo.GetGenericInfo("");

            foreach (Hashtable spec in systemspecs)
            {
                GA_Queue.AddItem(spec, GA_Submit.CategoryType.GA_Log, false);
            }
        }
    }
    public void SubmitAverageFPS()
    {
        if (_systemTracker == null)
            _systemTracker = GetComponent<GA_SystemTracker>();

        //average FPS
        if (_systemTracker.SubmitFpsAverage)
        {
            float timeSinceUpdate = Time.time - _lastUpdateAvg;
            float fpsSinceUpdate = _frameCountAvg / timeSinceUpdate;
            _lastUpdateAvg = Time.time;
            _frameCountAvg = 0;

            if (fpsSinceUpdate > 0)
            {
                if (GA.SettingsGA.TrackTarget != null)
                    GA.API.Quality.NewEvent("GA:AverageFPS", ((int)fpsSinceUpdate).ToString(), GA.SettingsGA.TrackTarget.position);
                else
                    GA.API.Quality.NewEvent("GA:AverageFPS", ((int)fpsSinceUpdate).ToString());
            }
        }
    }
    public void SubmitCriticalFPS()
    {
        if (_systemTracker == null)
            _systemTracker = GetComponent<GA_SystemTracker>();

        //critical FPS
        if (_systemTracker.SubmitFpsCritical)
        {
            float timeSinceUpdate = Time.time - _lastUpdateCrit;
            float fpsSinceUpdate = _frameCountCrit / timeSinceUpdate;
            _lastUpdateCrit = Time.time;
            _frameCountCrit = 0;

            if (fpsSinceUpdate <= _systemTracker.FpsCriticalThreshold)
            {
                if (GA.SettingsGA.TrackTarget != null)
                    GA.API.Quality.NewEvent("GA:CriticalFPS", _frameCountCrit.ToString(), GA.SettingsGA.TrackTarget.position);
                else
                    GA.API.Quality.NewEvent("GA:CriticalFPS", _frameCountCrit.ToString());

            }
        }
    }
Exemple #11
0
    void OnDestroy()
    {
        if (!Application.isPlaying)
        {
            return;
        }

        if (GA_SYSTEMTRACKER == this)
        {
            GA_SYSTEMTRACKER = null;
        }

                #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)
        if (GA.API.Debugging.SubmitErrors)
        {
            Application.RegisterLogCallback(null);
        }
                #else
        if (GA.API.Debugging.SubmitErrors)
        {
            Application.logMessageReceived -= GA.API.Debugging.HandleLog;
        }
                #endif
    }
Exemple #12
0
 void OnDestroy()
 {
     if (GA_SYSTEMTRACKER == this)
         GA_SYSTEMTRACKER = null;
 }
    void OnDestroy()
    {
        if (!Application.isPlaying)
            return;

        if (GA_SYSTEMTRACKER == this)
            GA_SYSTEMTRACKER = null;
    }
Exemple #14
0
    //private GUIContent _guiAllowScreenshot		= new GUIContent("Take Screenshot", "If enabled the player will be able to include a screenshot when submitting feedback and bug reports (This feature is not yet fully implemented).");

    override public void OnInspectorGUI()
    {
        GA_SystemTracker ga = target as GA_SystemTracker;

        EditorGUI.indentLevel = 1;
        EditorGUILayout.Space();

        GUILayout.BeginHorizontal();

        GUILayout.Label("GameAnalytics system tracker", EditorStyles.largeLabel);

        if (GUILayout.Button(_documentationLink, GUILayout.MaxWidth(60)))
        {
            Application.OpenURL("http://easy.gameanalytics.com/SupportDocu");
        }

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Basic component for tracking system info, errors, fps, etc.", EditorStyles.miniLabel);
        GUILayout.EndHorizontal();

        EditorGUILayout.Space();

        GUILayout.BeginHorizontal();
        GUILayout.Label("", GUILayout.Width(7));
        GUILayout.Label(_useForSubsequentLevels, GUILayout.Width(150));
        ga.UseForSubsequentLevels = EditorGUILayout.Toggle("", ga.UseForSubsequentLevels);
        GUILayout.EndHorizontal();

        EditorGUILayout.Space();

        GUILayout.BeginHorizontal();
        GUILayout.Label("", GUILayout.Width(7));
        GUILayout.Label(_gdSceneChange, GUILayout.Width(150));
        ga.IncludeSceneChange = EditorGUILayout.Toggle("", ga.IncludeSceneChange);
        GUILayout.EndHorizontal();

        EditorGUILayout.Space();

        GUILayout.BeginHorizontal();
        GUILayout.Label("", GUILayout.Width(7));
        GUILayout.Label(_qaSystemSpecs, GUILayout.Width(150));
        ga.IncludeSystemSpecs = EditorGUILayout.Toggle("", ga.IncludeSystemSpecs);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("", GUILayout.Width(7));
        GUILayout.Label(_qaFpsAverage, GUILayout.Width(150));
        ga.SubmitFpsAverage = EditorGUILayout.Toggle("", ga.SubmitFpsAverage);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("", GUILayout.Width(7));
        GUILayout.Label(_qaFpsCritical, GUILayout.Width(150));
        ga.SubmitFpsCritical = EditorGUILayout.Toggle("", ga.SubmitFpsCritical, GUILayout.Width(35));
        GUI.enabled          = ga.SubmitFpsCritical;
        GUILayout.Label(_qaFpsCriticalThreshold, GUILayout.Width(35));

        int tmpFpsCriticalThreshold = 0;

        if (int.TryParse(EditorGUILayout.TextField(ga.FpsCriticalThreshold.ToString(), GUILayout.Width(36)), out tmpFpsCriticalThreshold))
        {
            ga.FpsCriticalThreshold = Mathf.Max(Mathf.Min(tmpFpsCriticalThreshold, 99), 5);
        }

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("", GUILayout.Width(7));
        GUILayout.Label(_qaFpsCriticalInterval, GUILayout.Width(150));
        ga.FpsCirticalSubmitInterval = EditorGUILayout.IntField("", ga.FpsCirticalSubmitInterval, GUILayout.Width(36));
        ga.FpsCirticalSubmitInterval = Mathf.Max(1, ga.FpsCirticalSubmitInterval);

        GUI.enabled = true;
        GUILayout.EndHorizontal();

        EditorGUILayout.Space();
        GUILayout.BeginHorizontal();

        ga.ErrorFoldOut = EditorGUILayout.Foldout(ga.ErrorFoldOut, _qaErrorHandling);
        GUILayout.EndHorizontal();

        if (ga.ErrorFoldOut)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(27));
            GUILayout.Label(_qaSubmitErrors, GUILayout.Width(150));
            ga.SubmitErrors = EditorGUILayout.Toggle("", ga.SubmitErrors);
            GUILayout.EndHorizontal();

            GUI.enabled = ga.SubmitErrors;

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(27));
            GUILayout.Label(_qaErrorSubmitStackTrace, GUILayout.Width(150));
            ga.SubmitErrorStackTrace = EditorGUILayout.Toggle("", ga.SubmitErrorStackTrace);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(27));
            GUILayout.Label(_qaErrorSystemSpecs, GUILayout.Width(150));
            ga.SubmitErrorSystemInfo = EditorGUILayout.Toggle("", ga.SubmitErrorSystemInfo);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("", GUILayout.Width(27));
            GUILayout.Label(_qaMaxErrorCount, GUILayout.Width(150));

            int tmpMaxErrorCount = 0;
            if (int.TryParse(EditorGUILayout.TextField(ga.MaxErrorCount.ToString(), GUILayout.Width(36)), out tmpMaxErrorCount))
            {
                ga.MaxErrorCount = Mathf.Max(Mathf.Min(tmpMaxErrorCount, 99), 1);
            }
            GUILayout.EndHorizontal();

            GUI.enabled = true;
        }


        EditorGUILayout.Space();
        GUILayout.BeginHorizontal();
        GUILayout.Label("", GUILayout.Width(7));
        GUILayout.Label(_guiEnabled, GUILayout.Width(150));
        ga.GuiEnabled = EditorGUILayout.Toggle("", ga.GuiEnabled);
        GUILayout.EndHorizontal();

        /*GUILayout.BeginHorizontal();
         * GUILayout.Label("", GUILayout.Width(7));
         * GUILayout.Label(_guiAllowScreenshot, GUILayout.Width(150));
         * ga.GuiAllowScreenshot = EditorGUILayout.Toggle("", ga.GuiAllowScreenshot);
         * GUILayout.EndHorizontal();*/

        EditorGUILayout.Space();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(ga);
        }
    }
	void OnDestroy()
	{
		if (!Application.isPlaying)
			return;
		
		if (GA_SYSTEMTRACKER == this)
			GA_SYSTEMTRACKER = null;

		#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)
		if (GA.API.Debugging.SubmitErrors)
			Application.RegisterLogCallback(null);
		#else
		if (GA.API.Debugging.SubmitErrors)
			Application.logMessageReceived -= GA.API.Debugging.HandleLog;
		#endif
	}