SampleMetadata.cs
3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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,
BuildTargetGroup.Lumin
}
}
}
};
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;
}
}
}