Мои Уведомления
Привет, !
Мой Аккаунт Мои Финансы Мои Подписки Мои Настройки Выход
Руководство API скрипты

AssetDatabase.WriteImportSettingsIfDirty

Объявление

public static bool WriteImportSettingsIfDirty(string path);

Описание

Записывает настройки импорта на диск.

Для того, чтобы кеш-сервер импортировал активы.

using UnityEngine; using UnityEditor; public class AssetDatabaseExamples : MonoBehaviour { [MenuItem("AssetDatabase/Set Cookies Import Settings")] static void SetCookiesImportSettings() { for (var i = 0; i < 10; i++) { var texturePath = $"Assets/Lighting/Cookies/LightingCookie{i}.jpg"; var textureImporter = TextureImporter.GetAtPath(texturePath) as TextureImporter; textureImporter.textureType = TextureImporterType.Cookie; textureImporter.alphaSource = TextureImporterAlphaSource.FromGrayScale; //This method saves the Cookies import settings, without it the editor will ask you to apply unapplied settings AssetDatabase.WriteImportSettingsIfDirty(texturePath); } } }
Вы можете отблагодарить автора, за перевод документации на русский язык. ₽ Спасибо
API скрипты 2021.3