EditorUtility
- ClearProgressBar
- CloneComponent
- CollectDeepHierarchy
- CollectDependencies
- CompressTexture
- CopySerialized
- CreateEmptyPrefab
- CreateGameObjectWithHideFlags
- DisplayCancelableProgressBar
- DisplayDialogComplex
- DisplayDialog
- DisplayPopupMenu
- DisplayProgressBar
- ExtractOggFile
- FindPrefabRoot
- FocusProjectWindow
- FormatBytes
- GetObjectEnabled
- GetPrefabParent
- GetPrefabType
- InstanceIDToObject
- InstantiatePrefab
- IsPersistent
- OpenFilePanel
- OpenFolderPanel
- ReconnectToLastPrefab
- ReplacePrefab
- ResetGameObjectToPrefabState
- ResetToPrefabState
- SaveFilePanelInProject
- SaveFilePanel
- SaveFolderPanel
- SetDirty
- SetObjectEnabled
- SetSelectedWireframeHidden
- UnloadUnusedAssetsIgnoreM...
- UnloadUnusedAssets
EditorUtility.OpenFilePanel 打开文件面板
static function OpenFilePanel (title : string, directory : string, extension : string) : string
Description描述
Displays the "open file" dialog and returns the selected path name.
显示“open file”对话框,并返回选择的路径名。
参见:SaveFilePanel function.
Open File Panel.
打开文件面板
// Opens a file selection dialog for a PNG file and overwrites any
// selected texture with the contents.
//打开一个PNG文件选择对话框,并覆盖任何选择的内容纹理
class EditorUtilityOpenFilePanel {
@MenuItem("Examples/Overwrite Texture")
static function Apply () {
var texture : Texture2D = Selection.activeObject;
if (texture == null) {
EditorUtility.DisplayDialog(
"Select Texture",
"You Must Select a Texture first!",
"Ok");
return;
}
var path = EditorUtility.OpenFilePanel(
"Overwrite with png",
"",
"png");
if (path.Length != 0) {
var www = WWW("file:///" + path);
www.LoadImageIntoTexture(texture);
}
}
}
最后修改:2011年7月15日 Friday 17:52