方法一:
EditorUtility.IsPersistent(Object target)
方法二:
AssetDatabase.GetAssetPath(Selection.activeObject)
如果是hierarchy中的則會(huì)返回空
如果是Project中的則會(huì)返回資源路徑
public static string GetAssetPath(int instanceID);
public static string GetAssetPath([Object]
Returns
string The asset path name, or null, or an empty string if the asset does not exist.
Description
Returns the path name relative to the project folder where the asset is stored.
All paths are relative to the project folder, for example: "Assets/MyTextures/hello.png".