using UnityEngine;
using Unity.XR.CoreUtils;
using Unity.XR.CoreUtils.Editor;
using UnityEngine.XR.Interaction.Toolkit.Inputs.Readers;
using UnityEngine.XR.Interaction.Toolkit.Utilities;
namespace UnityEditor.XR.Interaction.Toolkit
{
///
/// Settings class for XR Interaction Toolkit editor values.
///
[ScriptableSettingsPath(ProjectPath.k_XRInteractionSettingsFolder)]
class XRInteractionEditorSettings : EditorScriptableSettings
{
///
/// Returns the singleton settings instance or loads the settings asset if it exists.
/// Unlike , this method will not create the asset if it does not exist.
///
/// A settings class derived from , or .
internal static XRInteractionEditorSettings GetInstanceOrLoadOnly()
{
if (BaseInstance != null)
return BaseInstance;
// See CreateAndLoad() in base class.
const string filter = "t:{0}";
var settingsType = typeof(XRInteractionEditorSettings);
foreach (var guid in AssetDatabase.FindAssets(string.Format(filter, settingsType.Name)))
{
BaseInstance = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid));
if (BaseInstance != null)
break;
}
return BaseInstance;
}
///
/// Determines how the Inspector window displays fields.
///
///
///
public enum InputReaderPropertyDrawerMode
{
///
/// Display the property in a compact format, using a minimal number of lines.
///
Compact,
///
/// Display the effective input source underlying the property, using multiple lines.
///
MultilineEffective,
///
/// Display all the input sources underlying the property.
///
MultilineAll,
}
[SerializeField]
InputReaderPropertyDrawerMode m_InputReaderPropertyDrawerMode = InputReaderPropertyDrawerMode.Compact;
///
/// Gets the setting for how the Inspector window displays fields.
///
internal InputReaderPropertyDrawerMode inputReaderPropertyDrawerMode
{
get => m_InputReaderPropertyDrawerMode;
set => m_InputReaderPropertyDrawerMode = value;
}
}
}