initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"displayName":"Example XR Management implementation",
|
||||
"description": "Example code showing how to implement various portions of the XR Management API.",
|
||||
"createSeparatePackage": true
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f2f51cbe2f868114a9897eaca901d062
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
using System.Linq;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build;
|
||||
using UnityEditor.Build.Reporting;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple build processor that makes sure that any custom configuration that the user creates is
|
||||
/// correctly passed on to the provider implementation at runtime.
|
||||
///
|
||||
/// Custom configuration instances that are stored in EditorBuildSettings are not copied to the target build
|
||||
/// as they are considered unreferenced assets. In order to get them to the runtime side of things, they need
|
||||
/// to be serialized to the build app and deserialized at runtime. Previously this would be a manual process
|
||||
/// requiring the implementor to manually serialize to some location that can then be read from to deserialize
|
||||
/// at runtime. With the new PlayerSettings Preloaded Assets API we can now just add our asset to the preloaded
|
||||
/// list and have it be instantiated at app launch.
|
||||
///
|
||||
/// Note that the preloaded assets are only notified with Awake, so anything you want or need to do with the
|
||||
/// asset after launch needs to be handled there.
|
||||
///
|
||||
/// More info on APIs used here:
|
||||
/// * <a href="https://docs.unity3d.com/ScriptReference/EditorBuildSettings.html">EditorBuildSettings</a>
|
||||
/// * <a href="https://docs.unity3d.com/ScriptReference/PlayerSettings.GetPreloadedAssets.html>PlayerSettings.GetPreloadedAssets</a>
|
||||
/// * <a href="https://docs.unity3d.com/ScriptReference/PlayerSettings.SetPreloadedAssets.html">PlayerSettings.SetPreloadedAssets</a>
|
||||
/// </summary>
|
||||
public class SampleBuildProcessor : IPreprocessBuildWithReport, IPostprocessBuildWithReport
|
||||
{
|
||||
/// <summary>Override of <see cref="IPreprocessBuildWithReport"/> and <see cref="IPostprocessBuildWithReport"/></summary>
|
||||
public int callbackOrder
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
void CleanOldSettings()
|
||||
{
|
||||
UnityEngine.Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets();
|
||||
if (preloadedAssets == null)
|
||||
return;
|
||||
|
||||
var oldSettings = from s in preloadedAssets
|
||||
where s != null && s.GetType() == typeof(SampleSettings)
|
||||
select s;
|
||||
|
||||
if (oldSettings != null && oldSettings.Any())
|
||||
{
|
||||
var assets = preloadedAssets.ToList();
|
||||
foreach (var s in oldSettings)
|
||||
{
|
||||
assets.Remove(s);
|
||||
}
|
||||
|
||||
PlayerSettings.SetPreloadedAssets(assets.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Override of <see cref="IPreprocessBuildWithReport"/></summary>
|
||||
/// <param name="report">Build report.</param>
|
||||
public void OnPreprocessBuild(BuildReport report)
|
||||
{
|
||||
// Always remember to cleanup preloaded assets after build to make sure we don't
|
||||
// dirty later builds with assets that may not be needed or are out of date.
|
||||
CleanOldSettings();
|
||||
|
||||
SampleSettings settings = null;
|
||||
EditorBuildSettings.TryGetConfigObject(SampleConstants.k_SettingsKey, out settings);
|
||||
if (settings == null)
|
||||
return;
|
||||
|
||||
UnityEngine.Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets();
|
||||
|
||||
if (!preloadedAssets.Contains(settings))
|
||||
{
|
||||
var assets = preloadedAssets.ToList();
|
||||
assets.Add(settings);
|
||||
PlayerSettings.SetPreloadedAssets(assets.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Override of <see cref="IPostprocessBuildWithReport"/></summary>
|
||||
/// <param name="report">Build report.</param>
|
||||
public void OnPostprocessBuild(BuildReport report)
|
||||
{
|
||||
// Always remember to cleanup preloaded assets after build to make sure we don't
|
||||
// dirty later builds with assets that may not be needed or are out of date.
|
||||
CleanOldSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9216d372fe0de4086af31dce05526406
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.XR.Management;
|
||||
using UnityEditor.XR.Management.Metadata;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
class SamplePackage : IXRPackage
|
||||
{
|
||||
class SampleLoaderMetadata : IXRLoaderMetadata
|
||||
{
|
||||
public string loaderName { get; set; }
|
||||
public string loaderType { get; set; }
|
||||
public List<BuildTargetGroup> supportedBuildTargets { get; set; }
|
||||
}
|
||||
|
||||
class SamplePackageMetadata : IXRPackageMetadata
|
||||
{
|
||||
public string packageName { get; set; }
|
||||
public string packageId { get; set; }
|
||||
public string settingsType { get; set; }
|
||||
public List<IXRLoaderMetadata> loaderMetadata { get; set; }
|
||||
}
|
||||
|
||||
static IXRPackageMetadata s_Metadata = new SamplePackageMetadata() {
|
||||
packageName = "Sample Package <SAMPLE ONLY YOU MUST REIMPLEMENT>",
|
||||
packageId = "com.unity.xr.samplespackage",
|
||||
settingsType = typeof(SampleSettings).FullName,
|
||||
|
||||
loaderMetadata = new List<IXRLoaderMetadata>() {
|
||||
new SampleLoaderMetadata() {
|
||||
loaderName = "Sample Loader One <SAMPLE ONLY YOU MUST REIMPLEMENT>",
|
||||
loaderType = typeof(SampleLoader).FullName,
|
||||
supportedBuildTargets = new List<BuildTargetGroup>() {
|
||||
BuildTargetGroup.Standalone,
|
||||
BuildTargetGroup.WSA
|
||||
}
|
||||
},
|
||||
new SampleLoaderMetadata() {
|
||||
loaderName = "Sample Loader Two <SAMPLE ONLY YOU MUST REIMPLEMENT>",
|
||||
loaderType = typeof(SampleLoader).FullName,
|
||||
supportedBuildTargets = new List<BuildTargetGroup>() {
|
||||
BuildTargetGroup.Android,
|
||||
BuildTargetGroup.iOS,
|
||||
#if !UNITY_2021_2_OR_NEWER
|
||||
BuildTargetGroup.Lumin
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const string k_PackageNotificationTooltip =
|
||||
@"This loader is purely a sample and will not load any XR Device.
|
||||
|
||||
This message is a part of sample code to show how to register a loader that might contain issues or require additonal
|
||||
context. One example could be that the package that contains this loader is being deprecated and any user who intends to
|
||||
use the package needs to be aware of deprecation.
|
||||
|
||||
Click this icon to be taken to the XR Plug-in Management documentation home page.";
|
||||
const string k_PackageNotificationIcon = "console.warnicon.sml";
|
||||
const string k_PackageNotificationManagementDocsURL = @"https://docs.unity3d.com/Packages/com.unity.xr.management@latest/index.html";
|
||||
public IXRPackageMetadata metadata
|
||||
{
|
||||
get
|
||||
{
|
||||
// Register package notification information anytime the metadata is asked requested.
|
||||
var packageNotificationInfo = new PackageNotificationInfo(
|
||||
EditorGUIUtility.IconContent(k_PackageNotificationIcon),
|
||||
k_PackageNotificationTooltip,
|
||||
k_PackageNotificationManagementDocsURL);
|
||||
PackageNotificationUtils.RegisterPackageNotificationInformation(s_Metadata.packageId, packageNotificationInfo);
|
||||
return s_Metadata;
|
||||
}
|
||||
}
|
||||
|
||||
public bool PopulateNewSettingsInstance(ScriptableObject obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 096597fc41af0774aaedec0171d8566b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
using UnityEditor;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple custom editor used to show how to enable custom UI for XR Management
|
||||
/// configuraton data.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(SampleSettings))]
|
||||
public class SampleSettingsEditor : Editor
|
||||
{
|
||||
static string k_RequiresProperty = "m_RequiresItem";
|
||||
static string k_RuntimeToggleProperty = "m_RuntimeToggle";
|
||||
|
||||
static GUIContent k_ShowBuildSettingsLabel = new GUIContent("Build Settings");
|
||||
static GUIContent k_RequiresLabel = new GUIContent("Item Requirement");
|
||||
|
||||
static GUIContent k_ShowRuntimeSettingsLabel = new GUIContent("Runtime Settings");
|
||||
static GUIContent k_RuntimeToggleLabel = new GUIContent("Should I stay or should I go?");
|
||||
|
||||
bool m_ShowBuildSettings = true;
|
||||
bool m_ShowRuntimeSettings = true;
|
||||
|
||||
SerializedProperty m_RequiesItemProperty;
|
||||
SerializedProperty m_RuntimeToggleProperty;
|
||||
|
||||
/// <summary>Override of Editor callback.</summary>
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (serializedObject == null || serializedObject.targetObject == null)
|
||||
return;
|
||||
|
||||
if (m_RequiesItemProperty == null) m_RequiesItemProperty = serializedObject.FindProperty(k_RequiresProperty);
|
||||
if (m_RuntimeToggleProperty == null) m_RuntimeToggleProperty = serializedObject.FindProperty(k_RuntimeToggleProperty);
|
||||
|
||||
serializedObject.Update();
|
||||
m_ShowBuildSettings = EditorGUILayout.Foldout(m_ShowBuildSettings, k_ShowBuildSettingsLabel);
|
||||
if (m_ShowBuildSettings)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(m_RequiesItemProperty, k_RequiresLabel);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
m_ShowRuntimeSettings = EditorGUILayout.Foldout(m_ShowRuntimeSettings, k_ShowRuntimeSettingsLabel);
|
||||
if (m_ShowRuntimeSettings)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(m_RuntimeToggleProperty, k_RuntimeToggleLabel);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 81f90f56b259f4aba826980c947f4140
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
using System;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEditor.XR.Management;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Sample loader UI demonstrating how to provide your own loader selection UI for the
|
||||
/// loader selection list.
|
||||
/// </summary>
|
||||
[XRCustomLoaderUI("Samples.SampleLoader", BuildTargetGroup.Standalone)]
|
||||
public class SampleStandaloneLoaderUI : IXRCustomLoaderUI
|
||||
{
|
||||
static readonly string[] features = new string[]{
|
||||
"Feature One",
|
||||
"Feature Two",
|
||||
"Feature Three"
|
||||
};
|
||||
|
||||
struct Content
|
||||
{
|
||||
public static readonly GUIContent k_LoaderName = new GUIContent("Sample Loader One Custom <SAMPLE ONLY YOU MUST REIMPLEMENT>");
|
||||
public static readonly GUIContent k_Download = new GUIContent("Download");
|
||||
public static readonly GUIContent k_WarningIcon = EditorGUIUtility.IconContent("console.warnicon.sml");
|
||||
}
|
||||
|
||||
float renderLineHeight = 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsLoaderEnabled { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string[] IncompatibleLoaders => new string[] { "UnityEngine.XR.WindowsMR.WindowsMRLoader" };
|
||||
|
||||
/// <inheritdoc />
|
||||
public float RequiredRenderHeight { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetRenderedLineHeight(float height)
|
||||
{
|
||||
renderLineHeight = height;
|
||||
RequiredRenderHeight = height;
|
||||
|
||||
if (IsLoaderEnabled)
|
||||
{
|
||||
RequiredRenderHeight += features.Length * height;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public BuildTargetGroup ActiveBuildTargetGroup { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void OnGUI(Rect rect)
|
||||
{
|
||||
var size = EditorStyles.toggle.CalcSize(Content.k_LoaderName);
|
||||
var labelRect = new Rect(rect);
|
||||
labelRect.width = size.x;
|
||||
labelRect.height = renderLineHeight;
|
||||
IsLoaderEnabled = EditorGUI.ToggleLeft(labelRect, Content.k_LoaderName, IsLoaderEnabled);
|
||||
|
||||
// The following shows how to make draw an icon with a tooltip
|
||||
size = EditorStyles.label.CalcSize(Content.k_WarningIcon);
|
||||
var imageRect = new Rect(rect);
|
||||
imageRect.xMin = labelRect.xMax + 1;
|
||||
imageRect.width = size.y;
|
||||
imageRect.height = renderLineHeight;
|
||||
var iconWithTooltip = new GUIContent("", Content.k_WarningIcon.image, "Warning: This is a sample to show how to draw a custom icon with a tooltip!");
|
||||
EditorGUI.LabelField(imageRect, iconWithTooltip);
|
||||
|
||||
if (IsLoaderEnabled)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
var featureRect = new Rect(rect);
|
||||
featureRect.yMin = labelRect.yMax + 1;
|
||||
featureRect.height = renderLineHeight;
|
||||
foreach (var feature in features)
|
||||
{
|
||||
var buttonSize = EditorStyles.toggle.CalcSize(Content.k_Download);
|
||||
|
||||
var featureLabelRect = new Rect(featureRect);
|
||||
featureLabelRect.width -= buttonSize.x;
|
||||
EditorGUI.ToggleLeft(featureLabelRect, feature, false);
|
||||
|
||||
var buttonRect = new Rect(featureRect);
|
||||
buttonRect.xMin = featureLabelRect.xMax + 1;
|
||||
buttonRect.width = buttonSize.x;
|
||||
if (GUI.Button(buttonRect, Content.k_Download))
|
||||
{
|
||||
Debug.Log($"{feature} download button pressed. Do something here!");
|
||||
}
|
||||
|
||||
featureRect.yMin += renderLineHeight;
|
||||
featureRect.height = renderLineHeight;
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f20344b9494eebc47b9860adf04f6667
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "Unity.XR.Management.Samples.Editor",
|
||||
"references": [
|
||||
"Unity.XR.Management.Editor",
|
||||
"Unity.XR.Management.Samples",
|
||||
"Unity.XR.Management"
|
||||
],
|
||||
"optionalUnityReferences": [
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": []
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 20d89efd2cc1043e5ac2c8f870d4e8fa
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Static constants
|
||||
/// </summary>
|
||||
public static class SampleConstants
|
||||
{
|
||||
/// <summary>
|
||||
/// Key we use to store and retrieve custom configuration settings from EditorBuildSettings
|
||||
/// </summary>
|
||||
public const string k_SettingsKey = "com.unity.xr.management.sample_settings";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9fcb2c0388adf4dae9b9d876af26062c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine.XR;
|
||||
using UnityEngine.XR.Management;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEditor.XR.Management;
|
||||
#endif
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Sample loader implentation showing how to create simple loader.
|
||||
/// NOTE: You have to rename this class to make it appear in the loader list for
|
||||
/// XRManager.
|
||||
/// </summary>
|
||||
#if UNITY_EDITOR
|
||||
[XRSupportedBuildTarget(BuildTargetGroup.Standalone, new BuildTarget[]{ BuildTarget.StandaloneWindows, BuildTarget.StandaloneWindows64})]
|
||||
[XRSupportedBuildTarget(BuildTargetGroup.Android)]
|
||||
#endif
|
||||
public class SampleLoader : XRLoaderHelper
|
||||
{
|
||||
static List<XRInputSubsystemDescriptor> s_InputSubsystemDescriptors =
|
||||
new List<XRInputSubsystemDescriptor>();
|
||||
|
||||
/// <summary>Return the currently active Input Subsystem intance, if any.</summary>
|
||||
public XRInputSubsystem inputSubsystem
|
||||
{
|
||||
get { return GetLoadedSubsystem<XRInputSubsystem>(); }
|
||||
}
|
||||
|
||||
SampleSettings GetSettings()
|
||||
{
|
||||
SampleSettings settings = null;
|
||||
// When running in the Unity Editor, we have to load user's customization of configuration data directly from
|
||||
// EditorBuildSettings. At runtime, we need to grab it from the static instance field instead.
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorBuildSettings.TryGetConfigObject(SampleConstants.k_SettingsKey, out settings);
|
||||
#else
|
||||
settings = SampleSettings.s_RuntimeInstance;
|
||||
#endif
|
||||
return settings;
|
||||
}
|
||||
|
||||
#region XRLoader API Implementation
|
||||
|
||||
/// <summary>Implementaion of <see cref="XRLoader.Initialize"/></summary>
|
||||
/// <returns>True if successful, false otherwise</returns>
|
||||
public override bool Initialize()
|
||||
{
|
||||
SampleSettings settings = GetSettings();
|
||||
if (settings != null)
|
||||
{
|
||||
// TODO: Pass settings off to plugin prior to subsystem init.
|
||||
}
|
||||
|
||||
CreateSubsystem<XRInputSubsystemDescriptor, XRInputSubsystem>(s_InputSubsystemDescriptors, "InputSubsystemDescriptor");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Implementaion of <see cref="XRLoader.Start"/></summary>
|
||||
/// <returns>True if successful, false otherwise</returns>
|
||||
public override bool Start()
|
||||
{
|
||||
StartSubsystem<XRInputSubsystem>();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Implementaion of <see cref="XRLoader.Stop"/></summary>
|
||||
/// <returns>True if successful, false otherwise</returns>
|
||||
public override bool Stop()
|
||||
{
|
||||
StopSubsystem<XRInputSubsystem>();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Implementaion of <see cref="XRLoader.Deinitialize"/></summary>
|
||||
/// <returns>True if successful, false otherwise</returns>
|
||||
public override bool Deinitialize()
|
||||
{
|
||||
DestroySubsystem<XRInputSubsystem>();
|
||||
return base.Deinitialize();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7bc0125267fb14445a858e84633a46b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple sample settings showing how to create custom configuration data for your package.
|
||||
/// </summary>
|
||||
// Uncomment below line to have the settings appear in unified settings.
|
||||
//[XRConfigurationData("Sample Settings", SampleConstants.k_SettingsKey)]
|
||||
[System.Serializable]
|
||||
public class SampleSettings : ScriptableObject
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
/// <summary>Static instance that will hold the runtime asset instance we created in our build process.</summary>
|
||||
/// <see cref="SampleBuildProcessor"/>
|
||||
public static SampleSettings s_RuntimeInstance = null;
|
||||
#endif
|
||||
|
||||
/// <summary>Requirement settings enumeration</summary>
|
||||
public enum Requirement
|
||||
{
|
||||
/// <summary>Required</summary>
|
||||
Required,
|
||||
/// <summary>Optional</summary>
|
||||
Optional,
|
||||
/// <summary>None</summary>
|
||||
None
|
||||
}
|
||||
|
||||
[SerializeField, Tooltip("Changes item requirement.")]
|
||||
Requirement m_RequiresItem;
|
||||
|
||||
/// <summary>Whether or not the item is required.</summary>
|
||||
public Requirement requiresItem
|
||||
{
|
||||
get { return m_RequiresItem; }
|
||||
set { m_RequiresItem = value; }
|
||||
}
|
||||
|
||||
[SerializeField, Tooltip("Some toggle for runtime.")]
|
||||
bool m_RuntimeToggle = true;
|
||||
|
||||
/// <summary>Where we toggled?</summary>
|
||||
public bool runtimeToggle
|
||||
{
|
||||
get { return m_RuntimeToggle; }
|
||||
set { m_RuntimeToggle = value; }
|
||||
}
|
||||
|
||||
void Awake()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
s_RuntimeInstance = this;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c76bebe14424446cca62c6e29db5054f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "Unity.XR.Management.Samples",
|
||||
"references": [
|
||||
"Unity.XR.Management.Editor",
|
||||
"Unity.XR.Management"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": []
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4b8d623d49974443c835ab669d1771ed
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Add table
Add a link
Reference in a new issue