2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[自分用メモ] Unityのエディタ拡張時に選択しているAssetsのフォルダのパスを取得する

Last updated at Posted at 2016-10-01

内容

プロジェクトビューでAssetsフォルダ配下で現在選択しているフォルダのパスを取得する方法

テスト環境

Unity5.4.0p4
Windows10

実装

foreach (Object obj in Selection.GetFiltered(typeof(DefaultAsset), SelectionMode.DeepAssets))
{
    if (obj is DefaultAsset)
    {
        string path = AssetDatabase.GetAssetPath(obj);

        if(AssetDatabase.IsValidFolder(path))
        {
            Debug.Log("Valid folder. " + path);
        }
    }
}
2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?