9
5

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-WindowsPlayerで実行フォルダのパスを取得する

Last updated at Posted at 2019-02-13

Unity2018.2.21fで確認。

少し検索したところ思った以上にこの情報が見つからなかったのでメモがてら。
フリーソフトでよくある、setting.iniやらsetting.jsonをEXEを実行した場所に置きたい人向け。

		// Unityエディタ上ではStreamingAssetsのパスにする
#if UNITY_EDITOR
		FilePath = Directory.GetCurrentDirectory();//Editor上では普通にカレントディレクトリを確認
#else
		FilePath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\');//EXEを実行したカレントディレクトリ (ショートカット等でカレントディレクトリが変わるのでこの方式で)
#endif
		Debug.Log(FilePath);

参考:
http://var.blog.jp/archives/66978870.html

9
5
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
9
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?