Ejemplo n.º 1
0
        /// <summary>Attempts to apply import settings to images in icon path.</summary>
        public static void TryImportSettings()
        {
            // Grab the files in icon path:
            string[] fileSet = Directory.GetFiles(IconPath);
            int      count   = fileSet.Length;

            if (count <= 1)
            {
                return;
            }

            Status = 3;

            // Finally, update all images with the required import settings:
            ImageImport.ApplyToAll(fileSet);
        }
        public static void AutoImageSettings()
        {
            // Get the selection:
            UnityEngine.Object[] assets = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets);

            foreach (UnityEngine.Object obj in assets)
            {
                // Grab the paths:
                string path = AssetDatabase.GetAssetPath(obj);

                // Log a message:
                Debug.Log("Automatically applying import settings to " + path + "..");

                if (string.IsNullOrEmpty(path))
                {
                    continue;
                }

                // Note: Internally checks if path is a directory.
                ImageImport.Apply(path);
            }
        }