void ExecuteCurrentBuildAction()
        {
            if (HasModified())
            {
                var path   = AssetDatabase.GetAssetPath(assetTarget);
                int option = EditorUtility.DisplayDialogComplex("Unapplied import settings",
                                                                $"Unapplied import settings for '{path}'", "Apply", "Revert", "Cancel");
                switch (option)
                {
                case 0:     // Apply
                    Apply();
                    AssetDatabase.Refresh();
                    break;

                case 1:     // Revert
                    ResetValues();
                    AssetDatabase.Refresh();
                    break;

                case 2:     // Cancel
                    return;
                }
            }

            var config = assetTarget as BuildConfiguration;

            if (config == null || !config)
            {
                throw new NullReferenceException(nameof(config));
            }

            CurrentBuildAction.Action(config);
        }
Exemplo n.º 2
0
        void ExecuteCurrentBuildAction()
        {
            if (HasModified())
            {
                var path   = AssetDatabase.GetAssetPath(assetTarget);
                int option = EditorUtility.DisplayDialogComplex("Unapplied import settings",
                                                                $"Unapplied import settings for '{path}'", "Apply", "Revert", "Cancel");
                switch (option)
                {
                case 0:     // Apply
                    Apply();
                    break;

                case 1:     // Revert
                    ResetValues();
                    break;

                case 2:     // Cancel
                    return;
                }
            }

            EditorApplication.delayCall += () =>
            {
                var assetImporter = target as AssetImporter;
                if (assetImporter == null || !assetImporter)
                {
                    return;
                }

                AssetDatabase.ImportAsset(assetImporter.assetPath);

                var config = assetTarget as BuildConfiguration;
                if (config == null || !config)
                {
                    return;
                }

                CurrentBuildAction.Action(config);
            };
        }