Example #1
0
        public static void RegisterMonoScripts()
        {
            if (AssetDatabaseExperimental.IsAssetImportWorkerProcess() || s_Initialized)
            {
                return;
            }
            s_Initialized = true;

            AssetDatabaseExperimental.UnregisterCustomDependencyPrefixFilter("UnityEngineType/");

            var behaviours = TypeCache.GetTypesDerivedFrom <UnityEngine.MonoBehaviour>();
            var scripts    = TypeCache.GetTypesDerivedFrom <UnityEngine.ScriptableObject>();

            for (int i = 0; i != behaviours.Count; i++)
            {
                var type = behaviours[i];
                if (type.IsGenericType)
                {
                    continue;
                }
                var hash = TypeHash.CalculateStableTypeHash(type);
                AssetDatabaseExperimental.RegisterCustomDependency(TypeString(type),
                                                                   new UnityEngine.Hash128(hash, hash));
            }

            for (int i = 0; i != scripts.Count; i++)
            {
                var type = scripts[i];
                if (type.IsGenericType)
                {
                    continue;
                }
                var hash = TypeHash.CalculateStableTypeHash(type);
                AssetDatabaseExperimental.RegisterCustomDependency(TypeString(type),
                                                                   new UnityEngine.Hash128(hash, hash));
            }
        }