// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Utilities; #if WINDOWS_UWP && !ENABLE_IL2CPP using Microsoft.MixedReality.Toolkit; #endif // WINDOWS_UWP && !ENABLE_IL2CPP using System; namespace Microsoft.MixedReality.Toolkit { /// /// Constraint that allows selection of classes that extend a specific class when /// selecting a with the Unity inspector. /// public sealed class ExtendsAttribute : SystemTypeAttribute { /// /// Gets the type of class that selectable classes must derive from. /// public Type BaseType { get; private set; } /// /// Initializes a new instance of the class. /// /// Type of class that selectable classes must derive from. /// Gets or sets grouping of selectable classes. Defaults to unless explicitly specified. public ExtendsAttribute(Type baseType, TypeGrouping grouping) : base(baseType, grouping) { BaseType = baseType; } /// public override bool IsConstraintSatisfied(Type type) { return base.IsConstraintSatisfied(type) && BaseType.IsAssignableFrom(type) && type != BaseType; } } }