private void Start() { mail = GameObject.Find("Logger"); // Set Up Event System if (Application.isPlaying) { EventSystem sceneEventSystem = UnityEngine.Object.FindObjectOfType <EventSystem>(); if (sceneEventSystem == null) { GameObject eventSystem = new GameObject("EventSystem"); eventSystem.AddComponent <EventSystem>(); eventSystem.AddComponent <StandaloneInputModule>(); } } // Configure Client bool configured = false; if (this.UserReportingPlatform == UserReportingPlatformType.Async) { Assembly assembly = Assembly.GetExecutingAssembly(); Type asyncUnityUserReportingPlatformType = assembly.GetType("Unity.Cloud.UserReporting.Plugin.Version2018_3.AsyncUnityUserReportingPlatform"); if (asyncUnityUserReportingPlatformType != null) { object activatedObject = Activator.CreateInstance(asyncUnityUserReportingPlatformType); IUserReportingPlatform asyncUnityUserReportingPlatform = activatedObject as IUserReportingPlatform; if (asyncUnityUserReportingPlatform != null) { UnityUserReporting.Configure(asyncUnityUserReportingPlatform, this.GetConfiguration()); configured = true; } } } if (!configured) { UnityUserReporting.Configure(this.GetConfiguration()); } // Ping string url = string.Format("https://userreporting.cloud.unity3d.com/api/userreporting/projects/{0}/ping", UnityUserReporting.CurrentClient.ProjectIdentifier); UnityUserReporting.CurrentClient.Platform.Post(url, "application/json", Encoding.UTF8.GetBytes("\"Ping\""), (upload, download) => { }, (result, bytes) => { }); }
/// <summary> /// Creates a new instance of the <see cref="UserReportingClient"/> class. /// </summary> /// <param name="endpoint">The endpoint.</param> /// <param name="projectIdentifier">The project identifier.</param> /// <param name="platform">The platform.</param> /// <param name="configuration">The configuration.</param> public UserReportingClient(string endpoint, string projectIdentifier, IUserReportingPlatform platform, UserReportingClientConfiguration configuration) { // Arguments this.Endpoint = endpoint; this.ProjectIdentifier = projectIdentifier; this.Platform = platform; this.Configuration = configuration; // Configuration Clean Up this.Configuration.FramesPerMeasure = this.Configuration.FramesPerMeasure > 0 ? this.Configuration.FramesPerMeasure : 1; this.Configuration.MaximumEventCount = this.Configuration.MaximumEventCount > 0 ? this.Configuration.MaximumEventCount : 1; this.Configuration.MaximumMeasureCount = this.Configuration.MaximumMeasureCount > 0 ? this.Configuration.MaximumMeasureCount : 1; this.Configuration.MaximumScreenshotCount = this.Configuration.MaximumScreenshotCount > 0 ? this.Configuration.MaximumScreenshotCount : 1; // Lists this.clientMetrics = new Dictionary <string, UserReportMetric>(); this.currentMeasureMetadata = new Dictionary <string, string>(); this.currentMetrics = new Dictionary <string, UserReportMetric>(); this.events = new CyclicalList <UserReportEvent>(configuration.MaximumEventCount); this.measures = new CyclicalList <UserReportMeasure>(configuration.MaximumMeasureCount); this.screenshots = new CyclicalList <UserReportScreenshot>(configuration.MaximumScreenshotCount); // Device Metadata this.deviceMetadata = new List <UserReportNamedValue>(); foreach (KeyValuePair <string, string> kvp in this.Platform.GetDeviceMetadata()) { this.AddDeviceMetadata(kvp.Key, kvp.Value); } // Client Version this.AddDeviceMetadata("UserReportingClientVersion", "2.0"); // Synchronized Action this.synchronizedActions = new List <Action>(); this.currentSynchronizedActions = new List <Action>(); // Update Stopwatch this.updateStopwatch = new Stopwatch(); // Is Connected to Logger this.IsConnectedToLogger = true; }
/// <summary> /// Configures Unity User Reporting. /// </summary> /// <param name="endpoint">The endpoint.</param> /// <param name="projectIdentifier">The project identifier.</param> /// <param name="platform">The plaform.</param> /// <param name="configuration">The configuration.</param> public static void Configure(string endpoint, string projectIdentifier, IUserReportingPlatform platform, UserReportingClientConfiguration configuration) { UnityUserReporting.CurrentClient = new UserReportingClient(endpoint, projectIdentifier, platform, configuration); }
/// <summary> /// Configures Unity User Reporting. /// </summary> /// <param name="platform"></param> public static void Configure(IUserReportingPlatform platform) { UnityUserReporting.Configure("https://userreporting.cloud.unity3d.com", Application.cloudProjectId, platform, new UserReportingClientConfiguration()); }
/// <summary> /// Configures Unity User Reporting. /// </summary> /// <param name="projectIdentifier"></param> /// <param name="platform"></param> /// <param name="configuration"></param> public static void Configure(string projectIdentifier, IUserReportingPlatform platform, UserReportingClientConfiguration configuration) { UnityUserReporting.Configure("https://userreporting.cloud.unity3d.com", projectIdentifier, platform, configuration); }