Example #1
0
 public static void AssertInstanceDerivesFromOrEqual(object instance, Type baseType)
 {
     if (!UniDiUtilInternal.IsNull(instance))
     {
         Assert.That(instance.GetType().DerivesFromOrEqual(baseType),
                     "Invalid type given during bind command.  Expected type '{0}' to derive from type '{1}'", instance.GetType(), baseType);
     }
 }
Example #2
0
 public static void AssertInstanceDerivesFromOrEqual(object instance, IEnumerable <Type> parentTypes)
 {
     if (!UniDiUtilInternal.IsNull(instance))
     {
         foreach (var baseType in parentTypes)
         {
             AssertInstanceDerivesFromOrEqual(instance, baseType);
         }
     }
 }
Example #3
0
        public static void AssertIsValidGameObject(GameObject gameObject)
        {
            Assert.That(!UniDiUtilInternal.IsNull(gameObject), "Received null game object during bind command");

#if UNITY_EDITOR
            // Unfortunately we can't do this check because asset bundles return PrefabType.None here
            // as discussed here: https://github.com/svermeulen/UniDi/issues/269#issuecomment-323419408
            //Assert.That(PrefabUtility.GetPrefabType(gameObject) != PrefabType.Prefab,
            //"Expected game object but found prefab instead with name '{0}' during bind command", gameObject.name);
#endif
        }