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

EditorUtility.SaveFilePanelInProject

Объявление

public static string SaveFilePanelInProject(string title, string defaultName, string extension, string message);

Описание

Отображает диалоговое окно "сохранить файл" в папке "Активы" проекта и возвращает выбранный путь.

Смотрите так же: SaveFilePanel function.

Сохранить панель файлов в проекте.
using UnityEngine; using UnityEditor; using System.IO; public class SaveFilePanelInProjectExample : EditorWindow { [MenuItem("Example/Save Texture In Project")] static void Apply() { Texture2D texture = Selection.activeObject as Texture2D; if (texture == null) { EditorUtility.DisplayDialog("Select Texture", "You must select a texture first!", "OK"); return; } string path = EditorUtility.SaveFilePanelInProject("Save png", texture.name + "png", "png", "Please enter a file name to save the texture to"); if (path.Length != 0) { byte[] pngData = texture.EncodeToPNG(); if (pngData != null) { File.WriteAllBytes(path, pngData); // As we are saving to the asset folder, tell Unity to scan for modified or new assets AssetDatabase.Refresh(); } } } }
Вы можете отблагодарить автора, за перевод документации на русский язык. ₽ Спасибо
API скрипты 2021.3