#if ENABLE_CLOUD_SERVICES_ANALYTICS || UNITY_2023_2_OR_NEWER
using System;
using UnityEngine;
using UnityEngine.Analytics;
namespace UnityEditor.XR.Interaction.Toolkit.Analytics
{
///
/// The analytics event for a build.
///
#if UNITY_2023_2_OR_NEWER
[AnalyticInfo(k_EventName, XRIAnalytics.VendorKey, k_EventVersion, k_MaxEventsPerHour, k_MaxItems)]
#endif
class XRIBuildEvent : XRIBaseAnalyticsEvent
{
const string k_EventName = "xrinteractiontoolkit_build";
const int k_EventVersion = 2;
const int k_MaxEventsPerHour = XRIAnalytics.DefaultMaxEventsPerHour;
const int k_MaxItems = XRIAnalytics.DefaultMaxItems;
///
/// The analytics payload for a build.
///
[Serializable]
public struct Payload
#if UNITY_2023_2_OR_NEWER
: IAnalytic.IData
#endif
{
// Do not rename any field, the field names are used to identify the table/event column of this event payload.
///
/// The GUID of the build.
///
[SerializeField]
public string buildGuid;
///
/// The type of the build when this information is available, either "Player" or "AssetBundle" (or an empty string if unavailable).
/// UnityEditor.Build.Reporting.BuildType enum as a string.
/// Enum type only available in Unity 6 or newer, so this field is left blank in earlier versions.
///
[SerializeField]
public string buildType;
///
/// Whether Unity was launched with the -batchmode command line argument.
///
[SerializeField]
public bool batchMode;
///
/// The currently active build target.
/// UnityEditor.BuildTarget enum as a string.
///
[SerializeField]
public string activeBuildTarget;
///
/// The currently active build target group.
///
[SerializeField]
public string activeBuildTargetGroup;
///
/// Whether project settings has the automatic startup of XR at runtime enabled.
/// This is the checkbox for Initialize XR on Startup in Edit > Project Settings > XR Plug-in Management.
///
[SerializeField]
public bool initManagerOnStart;
///
/// The list of enabled XR Plug-in Management plug-in providers (UnityEngine.XR.Management.XRLoader).
/// This is the list of checkboxes in Edit > Project Settings > XR Plug-in Management.
///
[SerializeField]
public string[] activeLoaders;
///
/// The list of relevant XR packages that are installed in the project.
///
[SerializeField]
public PackageVersionData[] packages;
///
/// The list of imported XRI package samples and their originating package versions.
///
[SerializeField]
public SampleVersionData[] xriImportedSamples;
///
/// General project settings that does not relate to XR specifically.
///
[SerializeField]
public GeneralProjectSettingsData generalProjectSettings;
///
/// XRI package project settings data.
///
[SerializeField]
public XRIProjectSettingsData xriProjectSettings;
///
/// Oculus package project settings data. Only valid if Oculus is enabled in the XR Plug-in Management project settings.
///
[SerializeField]
public OculusProjectSettingsData oculusProjectSettings;
///
/// OpenXR package project settings data. Only valid if OpenXR is enabled in the XR Plug-in Management project settings.
///
[SerializeField]
public OpenXRProjectSettingsData openXRProjectSettings;
///
/// Summary data for the interactor components across all scenes in the build.
///
[SerializeField]
public ComponentSummaryData interactors;
///
/// Summary data for the interactable components across all scenes in the build.
///
[SerializeField]
public ComponentSummaryData interactables;
///
/// Summary data for the Locomotion Provider components across all scenes in the build.
///
[SerializeField]
public ComponentSummaryData locomotionProviders;
///
/// Summary data for the UI input module components across all scenes in the build.
///
[SerializeField]
public ComponentSummaryData uiInputModules;
///
/// Summary data for the UI raycaster components across all scenes in the build.
///
[SerializeField]
public ComponentSummaryData uiRaycasters;
///
/// Summary data for the XR Input Modality Manager components across all scenes in the build.
///
[SerializeField]
public ComponentSummaryData modalityManagers;
///
/// Information about the XR Input Modality Manager component.
///
[SerializeField]
public ModalityComponentData modalityInfo;
///
/// The number of scenes processed in the build.
/// This may be 0 if the build has already completed previously and the assets have not changed.
///
[SerializeField]
public int scenesCount;
///
/// Information about all the processed scenes in the build.
///
[SerializeField]
public StaticSceneData[] scenes;
///
/// Whether the scenes were actually processed during the build.
/// This is if OnProcessScene was skipped due to the build already
/// being completed previously and the assets have not changed.
///
[SerializeField]
public bool scenesProcessed;
///
/// The time the build was started.
/// This is DateTime.Ticks as reported in the UnityEditor.Build.Reporting.BuildSummary.
///
[SerializeField]
public long buildStartTimeTicks;
///
/// The time the build ended.
/// This is DateTime.Ticks as reported in the UnityEditor.Build.Reporting.BuildSummary.
///
[SerializeField]
public long buildEndTimeTicks;
///
/// The total time taken by the build process in seconds.
/// This is the duration as reported in the UnityEditor.Build.Reporting.BuildSummary.
///
[SerializeField]
public float buildDurationSeconds;
#if UNITY_2023_2_OR_NEWER
///
/// The package name of the XR Interaction Toolkit, i.e. com.unity.xr.interaction.toolkit.
///
[SerializeField]
public string package;
///
/// The version of the XR Interaction Toolkit package installed.
///
[SerializeField]
public string package_ver;
#endif
}
#if !UNITY_2023_2_OR_NEWER
///
public XRIBuildEvent() : base(k_EventName, k_EventVersion, k_MaxEventsPerHour, k_MaxItems)
{
}
#endif
}
}
#endif