using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.IO;
public class OpenAssetHandler
{
[OnOpenAsset]
public static bool OpenTextAsset(int instanceID, int line)
{
string assetPath = AssetDatabase.GetAssetPath(instanceID);
Object o = EditorUtility.InstanceIDToObject(instanceID);
Debug.Log(o);
if (o is MonoScript)
return false;
string extension = Path.GetExtension(assetPath);
if (o is TextAsset || extension == ".m" || extension == ".mm" || extension == ".h")
{
System.Diagnostics.Process.Start(Application.dataPath + "/../" + assetPath);
return true;
}
return false;
}
}
网友评论