コード例 #1
0
        public void Refresh()
        {
            if (Configuration == null || !Configuration.IsValid())
            {
                return;
            }

            if (Instance != null)
            {
                return;
            }

            Enabled = true;

            CaptureUnityMessages();
            _reportLimitWatcher = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin));


            BacktraceApi = new BacktraceApi(
                credentials: new BacktraceCredentials(Configuration.GetValidServerUrl()),

#if UNITY_2018_4_OR_NEWER
                ignoreSslValidation: Configuration.IgnoreSslValidation
#else
                ignoreSslValidation: false
#endif
                );
            BacktraceApi.EnablePerformanceStatistics = Configuration.PerformanceStatistics;

            if (!Configuration.DestroyOnLoad)
            {
                DontDestroyOnLoad(gameObject);
                _instance = this;
            }
            if (Configuration.Enabled)
            {
                Database = GetComponent <BacktraceDatabase>();
                if (Database != null)
                {
                    Database.Reload();
                    Database.SetApi(BacktraceApi);
                    Database.SetReportWatcher(_reportLimitWatcher);
                }
            }

            _nativeClient = NativeClientFactory.GetNativeClient(Configuration, name);
            if (_nativeClient != null)
            {
                foreach (var attribute in _clientAttributes)
                {
                    _nativeClient.SetAttribute(attribute.Key, attribute.Value);
                }
            }
            if (Configuration.SendUnhandledGameCrashesOnGameStartup && isActiveAndEnabled)
            {
                var nativeCrashUplaoder = new NativeCrashUploader();
                nativeCrashUplaoder.SetBacktraceApi(BacktraceApi);
                StartCoroutine(nativeCrashUplaoder.SendUnhandledGameCrashesOnGameStartup(_previousSessionAttachments));
            }
        }
コード例 #2
0
        public void Refresh()
        {
            if (Configuration == null || !Configuration.IsValid())
            {
                return;
            }

            Enabled = true;
            Annotations.GameObjectDepth = Configuration.GameObjectDepth;
            HandleUnhandledExceptions();
            _reportLimitWatcher = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin));


#if UNITY_2018_4_OR_NEWER
            BacktraceApi = new BacktraceApi(
                credentials: new BacktraceCredentials(Configuration.GetValidServerUrl()),
                ignoreSslValidation: Configuration.IgnoreSslValidation);
#else
            BacktraceApi = new BacktraceApi(new BacktraceCredentials(Configuration.GetValidServerUrl()));
#endif

            if (Configuration.DestroyOnLoad == false)
            {
                DontDestroyOnLoad(gameObject);
                _instance = this;
            }
            Database = GetComponent <BacktraceDatabase>();
            if (Database == null)
            {
                return;
            }
            Database.Reload();
            Database.SetApi(BacktraceApi);
            Database.SetReportWatcher(_reportLimitWatcher);
        }
コード例 #3
0
 /// <summary>
 /// Initialize new client instance with BacktraceCredentials
 /// </summary>
 /// <param name="backtraceCredentials">Backtrace credentials to access Backtrace API</param>
 /// <param name="attributes">Additional information about current application</param>
 /// <param name="databaseSettings">Backtrace database settings</param>
 /// <param name="reportPerMin">Number of reports sending per one minute. If value is equal to zero, there is no request sending to API. Value have to be greater than or equal to 0</param>
 public BacktraceBase(
     BacktraceCredentials backtraceCredentials,
     Dictionary <string, object> attributes = null,
     IBacktraceDatabase database            = null,
     uint reportPerMin = 3)
 {
     Attributes   = attributes ?? new Dictionary <string, object>();
     BacktraceApi = new BacktraceApi(backtraceCredentials, reportPerMin);
     Database     = database ?? new BacktraceDatabase();
     Database.SetApi(BacktraceApi);
     Database.Start();
 }
        private void Awake()
        {
            Database = GetComponent <BacktraceDatabase>();
            if (Configuration == null || !Configuration.IsValid())
            {
                Debug.LogWarning("Configuration doesn't exists or provided serverurl/token are invalid");
                return;
            }
            if (Configuration.HandleUnhandledExceptions)
            {
                HandleUnhandledExceptions();
            }
            BacktraceApi = new BacktraceApi(
                credentials: new BacktraceCredentials(Configuration.ServerUrl, Configuration.Token),
                reportPerMin: Convert.ToUInt32(Configuration.ReportPerMin));

            Database?.SetApi(BacktraceApi);
        }
コード例 #5
0
        public void Refresh()
        {
            if (Configuration == null || !Configuration.IsValid())
            {
                return;
            }

            if (Instance != null)
            {
                return;
            }

            Enabled  = true;
            _current = Thread.CurrentThread;
            CaptureUnityMessages();
            _reportLimitWatcher      = new ReportLimitWatcher(Convert.ToUInt32(Configuration.ReportPerMin));
            _clientReportAttachments = Configuration.GetAttachmentPaths();

            BacktraceApi = new BacktraceApi(
                credentials: new BacktraceCredentials(Configuration.GetValidServerUrl()),

#if UNITY_2018_4_OR_NEWER
                ignoreSslValidation: Configuration.IgnoreSslValidation
#else
                ignoreSslValidation: false
#endif
                );
            BacktraceApi.EnablePerformanceStatistics = Configuration.PerformanceStatistics;

            if (!Configuration.DestroyOnLoad)
            {
                DontDestroyOnLoad(gameObject);
                _instance = this;
            }
            var nativeAttachments = _clientReportAttachments.ToList()
                                    .Where(n => !string.IsNullOrEmpty(n))
                                    .OrderBy(System.IO.Path.GetFileName, StringComparer.InvariantCultureIgnoreCase).ToList();

            if (Configuration.Enabled)
            {
                Database = GetComponent <BacktraceDatabase>();
                if (Database != null)
                {
                    Database.Reload();
                    Database.SetApi(BacktraceApi);
                    Database.SetReportWatcher(_reportLimitWatcher);
                    if (Database.Breadcrumbs != null)
                    {
                        nativeAttachments.Add(Database.Breadcrumbs.GetBreadcrumbLogPath());
                    }
                    _nativeClient = NativeClientFactory.CreateNativeClient(Configuration, name, AttributeProvider.GenerateAttributes(false), nativeAttachments);
                    Database.EnableBreadcrumbsSupport();
                }
            }

            AttributeProvider.AddDynamicAttributeProvider(_nativeClient);

            if (Configuration.SendUnhandledGameCrashesOnGameStartup && isActiveAndEnabled)
            {
                var nativeCrashUplaoder = new NativeCrashUploader();
                nativeCrashUplaoder.SetBacktraceApi(BacktraceApi);
                StartCoroutine(nativeCrashUplaoder.SendUnhandledGameCrashesOnGameStartup());
            }
#if !UNITY_WEBGL
            EnableMetrics(false);
#endif
        }