浏览代码

removed prefix from runtime analytics

/0.9.0.preview.1_staging
Aryan Mann 3 年前
当前提交
3cdfac60
共有 2 个文件被更改,包括 20 次插入16 次删除
  1. 29
      com.unity.perception/Runtime/PerceptionAnalytics.cs
  2. 7
      com.unity.perception/Runtime/PerceptionAnalyticsStructs.cs

29
com.unity.perception/Runtime/PerceptionAnalytics.cs


const int k_MaxElementsInStruct = 100;
const int k_MaxEventsPerHour = 100;
/// <summary>
/// Stores whether each event has been registered successfully or not.
/// </summary>
"perceptionScenarioInformation", AnalyticsEventType.RuntimeAndEditor, 1,
"ai.cv"
"perceptionScenarioInformation", AnalyticsEventType.RuntimeAndEditor, 1
);
static readonly AnalyticsEvent k_EventRunInUnitySimulation = new AnalyticsEvent(
"runinunitysimulation", AnalyticsEventType.Editor, 1

};
#endregion
#region Common
#region Helpers
/// <summary>
/// Tries to register an event and returns whether it was registered successfully. The result is also cached in

/// <returns>Whether the event was successfully registered/</returns>
static bool TryRegisterPerceptionAnalyticsEvent(AnalyticsEvent theEvent)
{
// Make sure the event exists in the dictionary
if (!s_EventRegistrationStatus.ContainsKey(theEvent))
{
if (allEvents.Contains(theEvent))

}
// If registered previously, return true
// Try registering the event and update the dictionary accordingly
s_EventRegistrationStatus[theEvent] = true;
#if UNITY_EDITOR
var status = EditorAnalytics.RegisterEventWithLimit(theEvent.name, k_MaxEventsPerHour, k_MaxElementsInStruct, k_VendorKey);

s_EventRegistrationStatus[theEvent] &= status == AnalyticsResult.Ok;
// Debug.Log($"Registering event {theEvent.name}. Operation {(s_EventRegistrationStatus[theEvent] ? "" : "un")}successful.");
return s_EventRegistrationStatus[theEvent];
}

/// <param name="data">Payload of the event.</param>
static void SendPerceptionAnalyticsEvent(AnalyticsEvent theEvent, object data)
{
// Debug.Log($"Reporting {theEvent.name}.");
try
{
if (theEvent.type == AnalyticsEventType.Editor || theEvent.type == AnalyticsEventType.RuntimeAndEditor)
{
EditorAnalytics.SendEventWithLimit(theEvent.name, data, theEvent.versionId);
}
if (theEvent.type == AnalyticsEventType.Editor || theEvent.type == AnalyticsEventType.RuntimeAndEditor)
{
EditorAnalytics.SendEventWithLimit(theEvent.name, data, theEvent.versionId);
}
#else
if (theEvent.type == AnalyticsEventType.Runtime || theEvent.type == AnalyticsEventType.RuntimeAndEditor)
{

}
catch (Exception exc)
{
Debug.Log($"Unable to report ${theEvent.name}: {exc.Message}");
}
}
#endregion

7
com.unity.perception/Runtime/PerceptionAnalyticsStructs.cs


this.type = type;
this.versionId = versionId;
this.prefix = prefix;
// Make sure prefix is defined if the event is a runtime event
if (this.type == AnalyticsEventType.RuntimeAndEditor || this.type == AnalyticsEventType.Runtime)
{
Assert.IsTrue(!string.IsNullOrWhiteSpace(this.prefix));
}
}
}

public class PerceptionCameraData
{
public string captureTriggerMode;
// same as "firstCaptureFrame" of the Perception Camera
public int startAtFrame;
public int framesBetweenCaptures;
}

正在加载...
取消
保存