AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
UseWithAttribute.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using System;
5 using System.Collections.Generic;
6 #if UNITY_EDITOR
7 using UnityEditor;
8 #endif
9 
10 namespace HoloToolkit.Unity
11 {
12  // Indicates which components this class ought to be used with (though are not strictly required)
13  [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
14  public sealed class UseWithAttribute : Attribute
15  {
16  public Type[] UseWithTypes { get; private set; }
17 
18  // IL2CPP doesn't support attributes with object arguments that are array types
19  public UseWithAttribute(Type useWithType1, Type useWithType2 = null, Type useWithType3 = null, Type useWithType4 = null, Type useWithType5 = null)
20  {
21  List<Type> types = new List<Type>() { useWithType1 };
22 
23  if (useWithType2 != null)
24  types.Add(useWithType2);
25 
26  if (useWithType3 != null)
27  types.Add(useWithType3);
28 
29  if (useWithType4 != null)
30  types.Add(useWithType4);
31 
32  if (useWithType5 != null)
33  types.Add(useWithType5);
34 
35  UseWithTypes = types.ToArray();
36  }
37  }
38 }
UseWithAttribute(Type useWithType1, Type useWithType2=null, Type useWithType3=null, Type useWithType4=null, Type useWithType5=null)