private static bool RegisterEvent(string eventName)
        {
            const string vendorKey = "unity.tiny.editor";
            var          result    = EditorAnalytics.RegisterEventWithLimit(eventName, 100, 1000, vendorKey);

            switch (result)
            {
            case AnalyticsResult.Ok:
            {
                    #if UTINY_INTERNAL
                Debug.Log($"Tiny: Registered event: {eventName}");
                    #endif
                return(true);
            }

            case AnalyticsResult.TooManyRequests:
                // this is fine - event registration survives domain reload (native)
                return(true);

            default:
            {
                TraceError($"failed to register analytics event '{eventName}'. Result: '{result}'");
                return(false);
            }
            }
        }
        private bool RegisterEvent(string eventName)
        {
            const string vendorKey = "unity.testtools.codecoverage";
            var          result    = EditorAnalytics.RegisterEventWithLimit(eventName, 100, 1000, vendorKey);

            switch (result)
            {
            case AnalyticsResult.Ok:
            {
#if COVERAGE_ANALYTICS_LOGGING
                ResultsLogger.LogSessionItem($"Registered analytics event: {eventName}", LogVerbosityLevel.Info);
#endif
                return(true);
            }

            case AnalyticsResult.TooManyRequests:
                // this is fine - event registration survives domain reload (native)
                return(true);

            default:
            {
                ResultsLogger.LogSessionItem($"Failed to register analytics event {eventName}. Result: {result}", LogVerbosityLevel.Error);
                return(false);
            }
            }
        }
        private static bool RegisterEvent(string eventName)
        {
            const string vendorKey = "unity.scene-template";
            var          result    = EditorAnalytics.RegisterEventWithLimit(eventName, 100, 1000, vendorKey);

            switch (result)
            {
            case AnalyticsResult.Ok:
            {
#if PERFORMANCE_TRACKING_ANALYTICS_LOGGING
                Debug.Log($"SceneTemplate: Registered event: {eventName}");
#endif
                return(true);
            }

            case AnalyticsResult.TooManyRequests:
                // this is fine - event registration survives domain reload (native)
                return(true);

            default:
            {
                Console.WriteLine($"[ST] Failed to register analytics event '{eventName}'. Result: '{result}'");
                return(false);
            }
            }
        }
コード例 #4
0
        static bool EnableAnalytics()
        {
            if (s_EventsRegistered)
            {
                return(true);
            }


#if UNITY_EDITOR
            AnalyticsResult result = EditorAnalytics.RegisterEventWithLimit(k_RemotePolicyInitializedEventName, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey);
#else
            AnalyticsResult result = AnalyticsResult.UnsupportedPlatform;
#endif
            if (result != AnalyticsResult.Ok)
            {
                return(false);
            }

            s_EventsRegistered = true;

            if (s_SentRemotePolicyInitialized == null)
            {
                s_SentRemotePolicyInitialized = new HashSet <string>();
                s_TrainingSessionGuid         = Guid.NewGuid();
            }

            return(s_EventsRegistered);
        }
コード例 #5
0
        static bool EnableAnalytics()
        {
#if MLA_UNITY_ANALYTICS_MODULE_ENABLED
            if (s_EventsRegistered)
            {
                return(true);
            }
            foreach (var eventName in s_EventNames)
            {
#if UNITY_EDITOR
                AnalyticsResult result = EditorAnalytics.RegisterEventWithLimit(eventName, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey);
                if (result != AnalyticsResult.Ok)
                {
                    return(false);
                }
#else
                return(false);
#endif // UNITY_EDITOR
            }
            s_EventsRegistered = true;

            if (s_SentRemotePolicyInitialized == null)
            {
                s_SentRemotePolicyInitialized     = new HashSet <string>();
                s_SentTrainingBehaviorInitialized = new HashSet <string>();
                s_TrainingSessionGuid             = Guid.NewGuid();
            }

            return(s_EventsRegistered);
#else
            return(false);
#endif // MLA_UNITY_ANALYTICS_MODULE_ENABLED
        }
コード例 #6
0
ファイル: HDAnalytics.cs プロジェクト: GeorgeYarwood/Deeper
        public static void SendEvent()
        {
            if (!EditorAnalytics.enabled)
            {
                return;
            }

            var hdrpAsset = HDRenderPipeline.currentAsset;

            if (hdrpAsset == null)
            {
                return;
            }

            if (EditorAnalytics.RegisterEventWithLimit(k_EventName, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey) != AnalyticsResult.Ok)
            {
                return;
            }

            RenderPipelineSettings settings = hdrpAsset.currentPlatformRenderPipelineSettings;
            RenderPipelineSettings defaults = RenderPipelineSettings.NewDefault();

            var data = new EventData(DiffSettings(settings, defaults));

            EditorAnalytics.SendEventWithLimit(k_EventName, data);
        }
コード例 #7
0
        static bool EnableAnalytics()
        {
            if (s_EventRegistered)
            {
                return(true);
            }

#if UNITY_EDITOR && MLA_UNITY_ANALYTICS_MODULE
            AnalyticsResult result = EditorAnalytics.RegisterEventWithLimit(k_EventName, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey, k_EventVersion);
            if (result == AnalyticsResult.Ok)
            {
                s_EventRegistered = true;
            }
#elif MLA_UNITY_ANALYTICS_MODULE
            AnalyticsResult result = AnalyticsResult.UnsupportedPlatform;
            if (result == AnalyticsResult.Ok)
            {
                s_EventRegistered = true;
            }
#endif
            if (s_EventRegistered && s_SentModels == null)
            {
                s_SentModels = new HashSet <NNModel>();
            }

            return(s_EventRegistered);
        }
コード例 #8
0
ファイル: HDAnalytics.cs プロジェクト: vault51/Graphics
        public static void SendEvent()
        {
            if (!EditorAnalytics.enabled)
            {
                return;
            }

            var activeBuildTarget = EditorUserBuildSettings.activeBuildTarget;

            var qualityLevelCount = QualitySettings.names.Length;

            for (int i = 0; i < QualitySettings.names.Length; ++i)
            {
                var hdrpAsset = QualitySettings.GetRenderPipelineAssetAt(i) as HDRenderPipelineAsset;
                if (hdrpAsset != null)
                {
                    if (EditorAnalytics.RegisterEventWithLimit(k_UsageEventName, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey, k_UsageCurrentVersion) != AnalyticsResult.Ok)
                    {
                        continue;
                    }

                    RenderPipelineSettings settings = hdrpAsset.currentPlatformRenderPipelineSettings;
                    RenderPipelineSettings defaults = RenderPipelineSettings.NewDefault();

                    var guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(hdrpAsset.GetInstanceID()));
                    var data = new UsageEventData(activeBuildTarget, guid, DiffSettings(settings, defaults));

                    EditorAnalytics.SendEventWithLimit(k_UsageEventName, data, k_UsageCurrentVersion);
                }
            }
        }
コード例 #9
0
ファイル: SearchAnalytics.cs プロジェクト: yhn531/AMS
        private static bool RegisterEvent(string eventName)
        {
            const string vendorKey = "unity.quicksearch";
            var          result    = EditorAnalytics.RegisterEventWithLimit(eventName, 100, 1000, vendorKey);

            switch (result)
            {
            case AnalyticsResult.Ok:
            {
#if QUICKSEARCH_ANALYTICS_LOGGING
                Debug.Log($"QuickSearch: Registered event: {eventName}");
#endif
                return(true);
            }

            case AnalyticsResult.TooManyRequests:

                // this is fine - event registration survives domain reload (native)
                return(true);

            default:
            {
                Console.WriteLine($"[QS] Failed to register analytics event '{eventName}'. Result: '{result}'");
                return(false);
            }
            }
        }
コード例 #10
0
ファイル: OpenXRAnalytics.cs プロジェクト: BotsOP/RythmVRGAME
        private static bool Initialize()
        {
#if ENABLE_TEST_SUPPORT || !UNITY_ANALYTICS
            return(false);
#else
            if (s_Initialized)
            {
                return(true);
            }

#if UNITY_EDITOR
            if (!EditorAnalytics.enabled)
            {
                return(false);
            }

            if (AnalyticsResult.Ok != EditorAnalytics.RegisterEventWithLimit(kEventInitialize, kMaxEventsPerHour, kMaxNumberOfElements, kVendorKey))
#else
            if (AnalyticsResult.Ok != Analytics.Analytics.RegisterEvent(kEventInitialize, kMaxEventsPerHour, kMaxNumberOfElements, kVendorKey))
#endif
            { return(false); }

            s_Initialized = true;

            return(true);
#endif
        }
コード例 #11
0
        static bool EnableAnalytics()
        {
            var res = EditorAnalytics.RegisterEventWithLimit(k_EventName, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey);

            s_EventRegistered = res == AnalyticsResult.Ok;
            return(s_EventRegistered);
        }
コード例 #12
0
        private void SetupAnalytics()
        {
            int    maxEventsPerHour           = 100;
            int    maxNumberOfElementInStruct = 100;
            string vendorKey = "unity.immediate-window";

            EditorAnalytics.RegisterEventWithLimit("evaluatecode", maxEventsPerHour, maxNumberOfElementInStruct, vendorKey);
        }
コード例 #13
0
        public long     ts;            // in milliseconds

        public static void Setup()
        {
            int    maxEventsPerHour           = 1000;
            int    maxNumberOfElementInStruct = 100;
            string vendorKey = "unity.package-manager-ui";

            EditorAnalytics.RegisterEventWithLimit("packageManagerWindowUserAction", maxEventsPerHour, maxNumberOfElementInStruct, vendorKey);
        }
コード例 #14
0
        public void RegisterAnalyticsEvent(string name, int maxPerHour, int maxPropertiesPerEvent)
        {
            const string vendorKey = "unity.input";

            #if UNITY_EDITOR
            EditorAnalytics.RegisterEventWithLimit(name, maxPerHour, maxPropertiesPerEvent, vendorKey);
            #else
            Analytics.Analytics.RegisterEvent(name, maxPerHour, maxPropertiesPerEvent, vendorKey);
            #endif
        }
コード例 #15
0
        public static void EnableAnalytics()
        {
#if UNITY_2018_1_OR_NEWER
            AnalyticsResult result = EditorAnalytics.RegisterEventWithLimit(k_EventTopicName, k_MaxEventsPerHour, k_MaxEventItems, k_VendorKey);
            if (result == AnalyticsResult.Ok)
            {
                s_EnableAnalytics = true;
            }
#endif
        }
コード例 #16
0
        //Returns true if registering the event was successful
        private static bool RegisterEvent()
        {
            AnalyticsResult registerEvent = EditorAnalytics.RegisterEventWithLimit(EventName, 100, 100, VendorKey);

            if (registerEvent == AnalyticsResult.Ok)
            {
                _eventRegistered = true;
            }

            return(_eventRegistered);
        }
コード例 #17
0
        static bool EnableAnalytics()
        {
            AnalyticsResult result = EditorAnalytics.RegisterEventWithLimit(k_EventName, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey);

            if (result == AnalyticsResult.Ok)
            {
                s_EventRegistered = true;
            }

            return(s_EventRegistered);
        }
コード例 #18
0
        static bool RegisterEvent(string name)
        {
            AnalyticsResult result = EditorAnalytics.RegisterEventWithLimit(name, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey);

            if (result != AnalyticsResult.Ok)
            {
                DebugError("Error in RegisterEvent: {0}", result);
                return(false);
            }
            return(true);
        }
コード例 #19
0
        private static void SetUpIfNeeded()
        {
            if (isSetUp)
            {
                return;
            }

            isSetUp = true;
            EditorAnalytics.RegisterEventWithLimit(RunFinishedEventName, 60, 30, VendorKey);
            EditorAnalytics.RegisterEventWithLimit(AnalyzeTestTreeName, 3, 30, VendorKey);
        }
コード例 #20
0
        public AnalyticsResult SendData(string eventString, IAnalyticsData data)
        {
            //Debug.Log("Sent Data " + JsonUtility.ToJson(data));
            if (false == s_Initialize)
            {
                EditorAnalytics.RegisterEventWithLimit(AnalyticsDataTypes.k_LightDataString, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey, k_Version);
                EditorAnalytics.RegisterEventWithLimit(AnalyticsDataTypes.k_Renderer2DDataString, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey, k_Version);
                s_Initialize = true;
            }

            return(EditorAnalytics.SendEventWithLimit(eventString, data, k_Version));
        }
コード例 #21
0
        private static bool RegisterEvent()
        {
            if (!_isRegistered)
            {
                var result = EditorAnalytics.RegisterEventWithLimit(EventName, MaxEventsPerHour, MaxNumberOfElements, VendorKey);
                if (result == UnityEngine.Analytics.AnalyticsResult.Ok)
                {
                    _isRegistered = true;
                }
            }

            return(_isRegistered);
        }
コード例 #22
0
        static bool RegisterEvent()
        {
#if UNITY_EDITOR
            AnalyticsResult result = EditorAnalytics.RegisterEventWithLimit(k_EventName, k_MaxEventsPerHour,
                                                                            k_MaxNumberOfElements, k_VendorKey, k_VersionId);
#else // IF !UNITY_EDITOR
            AnalyticsResult result = Analytics.RegisterEvent(k_EventName, k_MaxEventsPerHour,
                                                             k_MaxNumberOfElements, k_VendorKey, k_VersionId);
#endif

            bool isResultOk = result == AnalyticsResult.Ok;
            return(isResultOk);
        }
コード例 #23
0
        public static void SendStopEvent(RecorderController controller, bool error)
        {
            if (!EditorAnalytics.enabled)
            {
                return;
            }

            EditorAnalytics.RegisterEventWithLimit(completeEventName, maxEventsPerHour, maxNumberOfElements, vendorKey);

            var data = CreateStopEvent(controller, error);

            EditorAnalytics.SendEventWithLimit(completeEventName, data);
        }
コード例 #24
0
        private static void SendEvent <T>(T eventObject, string eventName)
        {
#if UNITY_EDITOR
            if (!EditorAnalytics.enabled)
            {
                return;
            }

            EditorAnalytics.RegisterEventWithLimit(eventName, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey);

            EditorAnalytics.SendEventWithLimit(eventName, eventObject);
#endif
        }
コード例 #25
0
        // Used by the Timeline
        public static void SendStartEvent(RecordingSession session)
        {
            if (!EditorAnalytics.enabled)
            {
                return;
            }

            EditorAnalytics.RegisterEventWithLimit(startEventName, maxEventsPerHour, maxNumberOfElements, vendorKey);
            var data = CreateSessionStartEvent(session);

            // Send the data to the database
            EditorAnalytics.SendEventWithLimit(startEventName, data);
        }
コード例 #26
0
        public static void SendStopEvent(RecordingSession session, bool error, bool complete)
        {
            if (!EditorAnalytics.enabled)
            {
                return;
            }

            EditorAnalytics.RegisterEventWithLimit(completeEventName, maxEventsPerHour, maxNumberOfElements, vendorKey);

            var data = CreateStopEvent(session, error, complete);

            // Send the data to the database
            EditorAnalytics.SendEventWithLimit(completeEventName, data);
        }
コード例 #27
0
        static bool TryRegisterEvents()
        {
            if (s_IsRegistered)
            {
                return(true);
            }

            var success = true;

            success &= EditorAnalytics.RegisterEventWithLimit(k_RunInUnitySimulationName, k_MaxEventsPerHour, k_MaxItems,
                                                              k_VendorKey) == AnalyticsResult.Ok;

            s_IsRegistered = success;
            return(success);
        }
        public static void SendEvent(bool buttonClick)
        {
            if (!EditorAnalytics.enabled)
            {
                return;
            }

            EditorAnalytics.RegisterEventWithLimit(k_EventName, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey);

            AnalyticsData data = new AnalyticsData()
            {
                create_simulation_btn_click = buttonClick
            };

            EditorAnalytics.SendEventWithLimit(k_EventName, data);
        }
コード例 #29
0
ファイル: HDAnalytics.cs プロジェクト: vault51/Graphics
        public static void SendDefaultValuesEvent()
        {
            if (!EditorAnalytics.enabled)
            {
                return;
            }

            if (EditorAnalytics.RegisterEventWithLimit(k_DefaultsEventName, k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey) != AnalyticsResult.Ok)
            {
                return;
            }

            RenderPipelineSettings defaults = RenderPipelineSettings.NewDefault();

            var data = new DefaultsEventData(AllSettings(defaults));

            EditorAnalytics.SendEventWithLimit(k_DefaultsEventName, data);
        }
コード例 #30
0
        /// <summary>
        /// Send analytics event when using entering playmode
        /// </summary>
        /// <param name="state">State change to detect entering playmode</param>
        static void SendAnalyticsOnPlayEnter(PlayModeStateChange state)
        {
            // Only send analytics if it is enabled
            if (!EditorAnalytics.enabled)
            {
                return;
            }

            // Only send data when entering playmode
            if (state != PlayModeStateChange.EnteredPlayMode)
            {
                return;
            }

            var startTime = Time.realtimeSinceStartup;

            var cinemachineCore = CinemachineCore.Instance;
            var vcamCount       = cinemachineCore.VirtualCameraCount;
            var vcamDatas       = new List <VcamData>();

            // collect data from all vcams
            for (int i = 0; i < vcamCount; ++i)
            {
                var vcamBase = cinemachineCore.GetVirtualCamera(i);
                CollectData(vcamBase, i.ToString(), ref vcamDatas);
            }

            var projectData = new ProjectData
            {
                brain_count  = cinemachineCore.BrainCount,
                vcam_count   = cinemachineCore.VirtualCameraCount,
                cam_count    = Camera.allCamerasCount,
                vcams        = vcamDatas,
                time_elapsed = Time.realtimeSinceStartup - startTime,
            };

            // Register our event
            EditorAnalytics.RegisterEventWithLimit("cm_vcams_on_play",
                                                   k_MaxEventsPerHour, k_MaxNumberOfElements, k_VendorKey);

            // Send the data to the database
            EditorAnalytics.SendEventWithLimit("cm_vcams_on_play", projectData);
        }