コード例 #1
0
 protected override void DrawPropertyLayout(GUIContent label)
 {
     for (int i = 0; i < this.Property.Children.Count; i++)
     {
         AutomatedValidationHook val = this.Property.Children[i].ValueEntry.WeakSmartValue as AutomatedValidationHook;
         this.Property.Children[i].Draw(new GUIContent(val.Name));
     }
 }
コード例 #2
0
        private void ResetData(bool overridePreExistingProfileAssets)
        {
            var scanAllAssets = this.GetOrCreateValidationProfileSubAsset <AssetValidationProfileAsset, AssetValidationProfile>(new AssetValidationProfile()
            {
                Name          = "Scan All Assets",
                Description   = "Scans all prefabs and scriptable objects in the project",
                AssetPaths    = new string[] { "Assets" },
                SearchFilters = new string[] { "t:Prefab", "t:ScriptableObject" }
            }, overridePreExistingProfileAssets);

            var scanAllScenes = this.GetOrCreateValidationProfileSubAsset <SceneValidationProfileAsset, SceneValidationProfile>(new SceneValidationProfile()
            {
                Name        = "Scan All Scenes",
                Description = "Scans all scenes in the project",
                ScenePaths  = new string[] { "Assets" }
            }, overridePreExistingProfileAssets);

            var scanEntireProject = this.GetOrCreateValidationProfileSubAsset <ValidationCollectionProfileAsset, ValidationCollectionProfile>(new ValidationCollectionProfile()
            {
                Name        = "Scan Entire Project",
                Description = "Scans all prefabs, scriptable objects and scenes in the project",
                Profiles    = new ValidationProfileAsset[] { scanAllAssets, scanAllScenes }
            }, overridePreExistingProfileAssets);

            var scanOpenScenes = this.GetOrCreateValidationProfileSubAsset <SceneValidationProfileAsset, SceneValidationProfile>(new SceneValidationProfile()
            {
                Name              = "Scan Open Scenes",
                Description       = "Scans all open scenes, without going through scene asset dependencies.",
                IncludeOpenScenes = true,
            }, overridePreExistingProfileAssets);

            var scanScenesFromBuildOptions = this.GetOrCreateValidationProfileSubAsset <SceneValidationProfileAsset, SceneValidationProfile>(new SceneValidationProfile()
            {
                Name        = "Scan Scenes From Build Options",
                Description = "Scans all scenes from build options, including scene asset dependencies.",
                IncludeScenesFromBuildOptions = true,
                IncludeAssetDependencies      = true,
            }, overridePreExistingProfileAssets);

            var onPlayHook = new AutomatedValidationHook(new OnPlayValidationHook())
            {
                Enabled     = false,
                Validations = new List <AutomatedValidation>()
                {
                    new AutomatedValidation()
                    {
                        Actions       = AutomatedValidation.Action.OpenValidatorIfError | AutomatedValidation.Action.OpenValidatorIfWarning,
                        ProfilesToRun = new List <IValidationProfile>()
                        {
                            scanOpenScenes
                        }
                    }
                }
            };

            var onBuild = new AutomatedValidationHook(new OnBuildValidationHook())
            {
                Enabled     = false,
                Validations = new List <AutomatedValidation>()
                {
                    new AutomatedValidation()
                    {
                        Actions       = AutomatedValidation.Action.OpenValidatorIfError | AutomatedValidation.Action.OpenValidatorIfWarning,
                        ProfilesToRun = new List <IValidationProfile>()
                        {
                            scanScenesFromBuildOptions
                        }
                    }
                }
            };

            var onStartup = new AutomatedValidationHook(new OnProjectStartupValidationHook())
            {
                Enabled     = false,
                Validations = new List <AutomatedValidation>()
                {
                    new AutomatedValidation()
                    {
                        Actions       = AutomatedValidation.Action.OpenValidatorIfError | AutomatedValidation.Action.OpenValidatorIfWarning,
                        ProfilesToRun = new List <IValidationProfile>()
                        {
                            scanEntireProject
                        }
                    }
                }
            };

            this.MainValidationProfiles = new List <IValidationProfile>()
            {
                scanEntireProject,
                scanAllAssets,
                scanAllScenes,
                scanOpenScenes,
                scanScenesFromBuildOptions,
            };

            this.Hooks = new List <AutomatedValidationHook>()
            {
                onPlayHook,
                onBuild,
                onStartup
            };
        }