上传YomovSDK
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.OpenXR.Features;
|
||||
using UnityEngine.XR.OpenXR.Samples.InterceptFeature;
|
||||
|
||||
namespace UnityEditor.XR.OpenXR.Samples.InterceptFeature
|
||||
{
|
||||
// see https://docs.unity3d.com/Manual/editor-CustomEditors.html for details on how to create custom editors
|
||||
[CustomEditor(typeof(InterceptCreateSessionFeature))]
|
||||
public class InterceptCreateSessionFeatureEditor : UnityEditor.Editor
|
||||
{
|
||||
private SerializedProperty message;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
// lookup any serialized properties you would want to draw in your UI.
|
||||
message = serializedObject.FindProperty("message");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
// draws the default property field.
|
||||
EditorGUILayout.PropertyField(message);
|
||||
|
||||
// https://docs.unity3d.com/ScriptReference/GUILayout.Button.html
|
||||
if (GUILayout.Button("Print This"))
|
||||
{
|
||||
message.stringValue = "Print This";
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Print That"))
|
||||
{
|
||||
message.stringValue = "Print That";
|
||||
}
|
||||
|
||||
// See https://docs.unity3d.com/ScriptReference/GUILayout.html
|
||||
// and https://docs.unity3d.com/ScriptReference/EditorGUILayout.html
|
||||
// for advanced UI options.
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9297f7f06c0094326b8474fa3ed60132
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.XR.OpenXR;
|
||||
using UnityEditor.XR.OpenXR.Features;
|
||||
using UnityEngine.XR.OpenXR.Samples.InterceptFeature;
|
||||
|
||||
namespace UnityEditor.XR.OpenXR.Samples.InterceptFeature
|
||||
{
|
||||
/// <summary>
|
||||
/// Automatically enables the InterceptCreateSessionFeature feature and then self-destructs
|
||||
/// </summary>
|
||||
[InitializeOnLoad]
|
||||
public class InterceptFeatureInstaller
|
||||
{
|
||||
#if !UNITY_SAMPLE_DEV
|
||||
private const string k_SamplePath = "Intercept Feature/Editor/InterceptFeatureInstaller.cs";
|
||||
|
||||
static InterceptFeatureInstaller()
|
||||
{
|
||||
EditorApplication.update += Install;
|
||||
}
|
||||
|
||||
private static void Install()
|
||||
{
|
||||
EditorApplication.update -= Install;
|
||||
|
||||
// Automatically enable the feature
|
||||
FeatureHelpers.RefreshFeatures(BuildTargetGroup.Standalone);
|
||||
var feature = OpenXRSettings.Instance.GetFeature<InterceptCreateSessionFeature>();
|
||||
if (feature != null)
|
||||
feature.enabled = true;
|
||||
|
||||
// Find this script in the asset database
|
||||
var source = AssetDatabase
|
||||
.FindAssets(Path.GetFileNameWithoutExtension(k_SamplePath))
|
||||
.Select(AssetDatabase.GUIDToAssetPath)
|
||||
.FirstOrDefault(r => r.Contains(k_SamplePath));
|
||||
|
||||
// Self destruct
|
||||
if (!string.IsNullOrEmpty(source))
|
||||
AssetDatabase.DeleteAsset(source);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70e178f5b6504a7585205b52e1fcefbf
|
||||
timeCreated: 1608222899
|
||||
Reference in New Issue
Block a user