File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Assets/MixedRealityToolkit/Attributes Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 55using Microsoft . MixedReality . Toolkit . Core . Definitions . Utilities ;
66using System ;
77using System . Linq ;
8+ using System . Reflection ;
89
910#if WINDOWS_UWP && ! ENABLE_IL2CPP
1011using Microsoft . MixedReality . Toolkit . Core . Extensions ;
@@ -60,9 +61,18 @@ public MixedRealityControllerAttribute(
6061 /// <summary>
6162 /// Convenience function for retrieving the attribute given a certain class type.
6263 /// </summary>
64+ /// <remarks>
65+ /// This function is only available in a UnityEditor context.
66+ /// </remarks>
6367 public static MixedRealityControllerAttribute Find ( Type type )
6468 {
69+ #if WINDOWS_UWP && ! ENABLE_IL2CPP
70+ // Type.GetCustomAttributes() doesn't exist on UWP .NET, so we have to indirectly use
71+ // the TypeInfo instead.
72+ return type . GetTypeInfo ( ) . GetCustomAttributes ( typeof ( MixedRealityControllerAttribute ) , true ) . FirstOrDefault ( ) as MixedRealityControllerAttribute ;
73+ #else
6574 return type . GetCustomAttributes ( typeof ( MixedRealityControllerAttribute ) , true ) . FirstOrDefault ( ) as MixedRealityControllerAttribute ;
75+ #endif
6676 }
6777 }
6878}
You can’t perform that action at this time.
0 commit comments