VR4Medical/ICI/Library/PackageCache/com.unity.xr.management@20be87dea580/Tests/StandaloneSubsystem/StandaloneSubsystemDescriptor.cs
2025-07-29 13:45:50 +03:00

65 lines
2.0 KiB
C#

using System;
#if UNITY_2020_2_OR_NEWER
using UnityEngine.SubsystemsImplementation;
#endif
namespace UnityEngine.XR.Management.Tests.Standalone
{
#if UNITY_2020_2_OR_NEWER
public class StandaloneSubsystemParams
{
public string id { get; set;}
public Type subsystemTypeOverride { get; set; }
public Type providerType { get; set; }
}
public class StandaloneSubsystemDescriptor : SubsystemDescriptorWithProvider<StandaloneSubsystem, StandaloneSubsystem.Provider>
{
public static void Create(StandaloneSubsystemParams descriptorParams)
{
var descriptor = new StandaloneSubsystemDescriptor(descriptorParams);
SubsystemDescriptorStore.RegisterDescriptor(descriptor);
}
StandaloneSubsystemDescriptor(StandaloneSubsystemParams descriptorParams)
{
id = descriptorParams.id;
subsystemTypeOverride = descriptorParams.subsystemTypeOverride;
providerType = descriptorParams.providerType;
}
}
#else
namespace Providing
{
public class StandaloneSubsystemParams
{
public string id { get; set;}
public System.Type subsystemImplementationType { get; set; }
public StandaloneSubsystemParams(string id, System.Type subsystemImplType)
{
this.id = id;
this.subsystemImplementationType = subsystemImplType;
}
}
}
public class StandaloneSubsystemDescriptor : SubsystemDescriptor<StandaloneSubsystem>
{
public static void Create(Providing.StandaloneSubsystemParams parms)
{
#if USE_LEGACY_SUBSYS_REGISTRATION
SubsystemRegistration.CreateDescriptor(new StandaloneSubsystemDescriptor(parms.id, parms.subsystemImplementationType));
#endif
}
public StandaloneSubsystemDescriptor(string id, System.Type subsystemImplType)
{
this.id = id;
this.subsystemImplementationType = subsystemImplType;
}
}
#endif
}