using Unity.XR.CoreUtils;
using UnityEngine.Assertions;
using UnityEngine.XR.Interaction.Toolkit.Utilities;
namespace UnityEngine.XR.Interaction.Toolkit.Inputs.Simulation
{
///
/// Configuration class for Interaction Simulator which
/// stores settings related to automatic instantiation.
///
[ScriptableSettingsPath(ProjectPath.k_XRInteractionSettingsFolder)]
class XRDeviceSimulatorSettings : ScriptableSettings
{
///
/// 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 XRDeviceSimulatorSettings GetInstanceOrLoadOnly()
{
if (BaseInstance != null)
return BaseInstance;
// See CreateAndLoad() in base class.
Assert.IsTrue(HasCustomPath);
BaseInstance = Resources.Load(GetFilePath(), typeof(XRDeviceSimulatorSettings)) as XRDeviceSimulatorSettings;
return BaseInstance;
}
[SerializeField]
bool m_AutomaticallyInstantiateSimulatorPrefab;
///
/// Setting this value to will tell the to look for and automatically
/// add the to the current scene if it does not already exist.
///
internal bool automaticallyInstantiateSimulatorPrefab
{
get => m_AutomaticallyInstantiateSimulatorPrefab;
set => m_AutomaticallyInstantiateSimulatorPrefab = value;
}
[SerializeField]
bool m_AutomaticallyInstantiateInEditorOnly = true;
///
/// Enable to only automatically instantiate the if the application is running inside the Unity Editor,
/// preventing it from automatically appearing in standalone builds. Disable to allow the simulator to be created in standalone builds.
///
///
/// Setting this value to will limit the to
/// only automatically instantiate the if the application is running inside the Unity Editor.
/// This property is only used if is enabled.
///
internal bool automaticallyInstantiateInEditorOnly
{
get => m_AutomaticallyInstantiateInEditorOnly;
set => m_AutomaticallyInstantiateInEditorOnly = value;
}
[SerializeField]
bool m_UseClassic;
///
/// Enable this to automatically use the legacy prefab. Disable to return to the default behavior of automatically using of the prefab instead.
///
internal bool useClassic
{
get => m_UseClassic;
set => m_UseClassic = value;
}
[SerializeField]
GameObject m_SimulatorPrefab;
///
/// This is the prefab to instantiate when is set to .
///
internal GameObject simulatorPrefab
{
get => m_SimulatorPrefab;
set => m_SimulatorPrefab = value;
}
}
}