public static bool OpenAsset (int instanceID, int lineNumber= -1);
public static bool OpenAsset (int instanceID, int lineNumber, int columnNumber);
public static bool OpenAsset (Object target, int lineNumber= -1);
public static bool OpenAsset (Object target, int lineNumber, int columnNumber);

Descripción

Opens the asset with associated application.

Opens asset in an external editor, texture application or modelling tool depending on what type of asset it is. If it is a text file, lineNumber and columnNumber instructs the text editor to go to that line and column. Returns true if asset opened successfully.

using UnityEditor;
using UnityEngine;

public class AssetDatabaseExamples : MonoBehaviour { [MenuItem("AssetDatabase/Manually Check Textures")] static void OpenAssetExample() { for (var i = 0; i < 10; i++) { var texturePath = AssetDatabase.LoadMainAssetAtPath($"Assets/Textures/GroundTexture{i}.jpg"); if(!EditorUtility.DisplayDialog($"Open next texture", $"Open GroundTexture{i}.jpg texture?", "Yes", "Cancel")) break; AssetDatabase.OpenAsset(texturePath); } } }

public static bool OpenAsset (Object[] objects);

Descripción

Opens the asset(s) with associated application(s).

Opens asset in an external editor, texture application or modelling tool depending on what type of asset it is. Returns true if all assets opened successfully.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961