IsScriptableObject() приватный статический Метод

private static IsScriptableObject ( Mono.Cecil.TypeDefinition temp ) : bool
temp Mono.Cecil.TypeDefinition
Результат bool
Пример #1
0
        public static bool ShouldImplementIDeserializable(TypeReference typeDeclaration)
        {
            if (typeDeclaration.FullName == "UnityEngine.ExposedReference`1")
            {
                return(true);
            }

            if (IsNonSerialized(typeDeclaration))
            {
                return(false);
            }

            var genericInstance = typeDeclaration as GenericInstanceType;

            if (genericInstance != null)
            {
                if (genericInstance.ElementType.FullName == "UnityEngine.ExposedReference`1")
                {
                    return(true);
                }

                return(false);
            }

            try
            {
                return(UnityEngineTypePredicates.IsMonoBehaviour(typeDeclaration) ||
                       UnityEngineTypePredicates.IsScriptableObject(typeDeclaration) ||
                       (typeDeclaration.CheckedResolve().IsSerializable&& !typeDeclaration.CheckedResolve().IsAbstract&& !typeDeclaration.CheckedResolve().CustomAttributes.Any(a => a.AttributeType.FullName.Contains("System.Runtime.CompilerServices.CompilerGenerated"))) ||
                       UnityEngineTypePredicates.ShouldHaveHadSerializableAttribute(typeDeclaration));
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public static bool IsScriptableObject(TypeReference type)
 {
     return(UnityEngineTypePredicates.IsScriptableObject(type.CheckedResolve()));
 }