0
0

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 3 years have passed since last update.

Unityゲーム内からエクスプローラーを起動する

Last updated at Posted at 2020-05-02

エクスプローラーの表示

ユーザーにStreamingAssetsなどの中身を見てもらったり編集してもらったりして欲しいときがあります。Untiyではゲーム内で決めたパスにエクスプローラーを表示することが可能です。

//StreamingAssetsのファイルパス
string path = Application.streamingAssetsPath;

//起動
System.Diagnostics.Process.Start(path);

System.Diagnostics.Process.Start()にただstring型を入れればできます。

ファイルが存在しない場合

Win32Exception: 指定されたファイルが見つかりません。

というエラーが出るので存在するかを確認させたほうがいいです。

    //ファイルの存在確認
   if (System.IO.File.Exists(path))
        System.Diagnostics.Process.Start(path);
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?