GitHub
4 年前
当前提交
6dcaa52c
共有 9 个文件被更改,包括 230 次插入 和 25 次删除
-
21TestProjects/PerceptionHDRP/Packages/packages-lock.json
-
63TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity
-
21TestProjects/PerceptionURP/Packages/packages-lock.json
-
1com.unity.perception/CHANGELOG.md
-
19com.unity.perception/Editor/GroundTruth/PerceptionCameraEditor.cs
-
24com.unity.perception/Editor/Randomization/Editors/RunInUnitySimulationWindow.cs
-
4com.unity.perception/Runtime/GroundTruth/SimulationState.cs
-
99com.unity.perception/Editor/Randomization/Editors/PerceptionEditorAnalytics.cs
-
3com.unity.perception/Editor/Randomization/Editors/PerceptionEditorAnalytics.cs.meta
|
|||
using System; |
|||
using JetBrains.Annotations; |
|||
using UnityEditor; |
|||
using UnityEngine.Analytics; |
|||
|
|||
namespace UnityEngine.Perception.Randomization.Editor |
|||
{ |
|||
static class PerceptionEditorAnalytics |
|||
{ |
|||
static int k_MaxItems = 100; |
|||
static int k_MaxEventsPerHour = 100; |
|||
const string k_VendorKey = "unity.perception"; |
|||
const string k_RunInUnitySimulationName = "runinunitysimulation"; |
|||
|
|||
static bool s_IsRegistered = false; |
|||
|
|||
static bool TryRegisterEvents() |
|||
{ |
|||
if (s_IsRegistered) |
|||
return true; |
|||
|
|||
bool success = true; |
|||
success &= EditorAnalytics.RegisterEventWithLimit(k_RunInUnitySimulationName, k_MaxEventsPerHour, k_MaxItems, |
|||
k_VendorKey) == AnalyticsResult.Ok; |
|||
|
|||
s_IsRegistered = success; |
|||
return success; |
|||
} |
|||
|
|||
enum RunStatus |
|||
{ |
|||
Started, |
|||
Failed, |
|||
Succeeded |
|||
} |
|||
|
|||
struct RunInUnitySimulationData |
|||
{ |
|||
[UsedImplicitly] |
|||
public string runId; |
|||
[UsedImplicitly] |
|||
public int totalIterations; |
|||
[UsedImplicitly] |
|||
public int instanceCount; |
|||
[UsedImplicitly] |
|||
public string existingBuildId; |
|||
[UsedImplicitly] |
|||
public string errorMessage; |
|||
[UsedImplicitly] |
|||
public string runExecutionId; |
|||
[UsedImplicitly] |
|||
public string runStatus; |
|||
} |
|||
|
|||
public static void ReportRunInUnitySimulationStarted(Guid runId, int totalIterations, int instanceCount, string existingBuildId) |
|||
{ |
|||
if (!TryRegisterEvents()) |
|||
return; |
|||
|
|||
var data = new RunInUnitySimulationData() |
|||
{ |
|||
runId = runId.ToString(), |
|||
totalIterations = totalIterations, |
|||
instanceCount = instanceCount, |
|||
existingBuildId = existingBuildId, |
|||
runStatus = RunStatus.Started.ToString() |
|||
}; |
|||
EditorAnalytics.SendEventWithLimit(k_RunInUnitySimulationName, data); |
|||
} |
|||
|
|||
public static void ReportRunInUnitySimulationFailed(Guid runId, string errorMessage) |
|||
{ |
|||
if (!TryRegisterEvents()) |
|||
return; |
|||
|
|||
var data = new RunInUnitySimulationData() |
|||
{ |
|||
runId = runId.ToString(), |
|||
errorMessage = errorMessage, |
|||
runStatus = RunStatus.Failed.ToString() |
|||
}; |
|||
EditorAnalytics.SendEventWithLimit(k_RunInUnitySimulationName, data); |
|||
} |
|||
|
|||
public static void ReportRunInUnitySimulationSucceeded(Guid runId, string runExecutionId) |
|||
{ |
|||
if (!TryRegisterEvents()) |
|||
return; |
|||
|
|||
var data = new RunInUnitySimulationData() |
|||
{ |
|||
runId = runId.ToString(), |
|||
runExecutionId = runExecutionId, |
|||
runStatus = RunStatus.Succeeded.ToString() |
|||
}; |
|||
EditorAnalytics.SendEventWithLimit(k_RunInUnitySimulationName, data); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3216e9e700a34acc8ac808ffccb8297c |
|||
timeCreated: 1607709612 |
撰写
预览
正在加载...
取消
保存
Reference in new issue