#if UNITY_EDITOR
using System;
namespace UnityEngine.InputSystem.Editor
{
///
/// Enumeration type identifying a Input System MonoBehavior component.
///
[Serializable]
internal enum InputSystemComponent
{
// Feature components
PlayerInput = 1,
PlayerInputManager = 2,
OnScreenStick = 3,
OnScreenButton = 4,
VirtualMouseInput = 5,
// Debug components
TouchSimulation = 1000,
// Integration components
StandaloneInputModule = 2000,
InputSystemUIInputModule = 2001,
}
///
/// Analytics record for tracking engagement with Input Component editor(s).
///
#if UNITY_2023_2_OR_NEWER
[UnityEngine.Analytics.AnalyticInfo(eventName: kEventName, maxEventsPerHour: kMaxEventsPerHour,
maxNumberOfElements: kMaxNumberOfElements, vendorKey: UnityEngine.InputSystem.InputAnalytics.kVendorKey)]
#endif // UNITY_2023_2_OR_NEWER
internal class InputComponentEditorAnalytic : UnityEngine.InputSystem.InputAnalytics.IInputAnalytic
{
public const string kEventName = "input_component_editor_closed";
public const int kMaxEventsPerHour = 100; // default: 1000
public const int kMaxNumberOfElements = 100; // default: 1000
///
/// The associated component type.
///
private readonly InputSystemComponent m_Component;
///
/// Represents component inspector editor data.
///
///
/// Ideally this struct should be readonly but then Unity cannot serialize/deserialize it.
///
[Serializable]
public struct Data : UnityEngine.InputSystem.InputAnalytics.IInputAnalyticData
{
///
/// Creates a new ComponentEditorData instance.
///
/// The associated component.
public Data(InputSystemComponent component)
{
this.component = component;
}
///
/// Defines the associated component.
///
public InputSystemComponent component;
}
public InputComponentEditorAnalytic(InputSystemComponent component)
{
info = new InputAnalytics.InputAnalyticInfo(kEventName, kMaxEventsPerHour, kMaxNumberOfElements);
m_Component = component;
}
#if UNITY_EDITOR && UNITY_2023_2_OR_NEWER
public bool TryGatherData(out UnityEngine.Analytics.IAnalytic.IData data, out Exception error)
#else
public bool TryGatherData(out InputAnalytics.IInputAnalyticData data, out Exception error)
#endif
{
data = new Data(m_Component);
error = null;
return true;
}
public InputAnalytics.InputAnalyticInfo info { get; }
}
}
#endif