teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

情報修正

2018/02/10 01:57

投稿

apple_pie
apple_pie

スコア25

title CHANGED
File without changes
body CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  現在Unityにて、テクスチャファイルを選択するための『ファイルを選択』ダイアログを作成しているのですが、ダイアログを開こうとするとエラーが起きます。
4
4
  ちなみに『System.Windows.Forms』は『C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll』をUnity内へインポートして使用しています。
5
+ なお、.exeとして出力した際にも使用出来るようにしたいのでUnityEditorはおやめください。
5
6
  分かる方いらっしゃいましたらご教授をよろしくお願いいたします。
6
7
 
7
8
  ### 発生している問題・エラーメッセージ
@@ -15,7 +16,7 @@
15
16
  System.Windows.Forms.CommonDialog.ShowDialog (System.Windows.Forms.IWin32Window owner) (at <5ab40f17fbbd42bc88c36ef7ce6a3719>:0)
16
17
  System.Windows.Forms.CommonDialog.ShowDialog () (at <5ab40f17fbbd42bc88c36ef7ce6a3719>:0)
17
18
  (wrapper remoting-invoke-with-check) System.Windows.Forms.CommonDialog:ShowDialog ()
18
- Test.OpenTextureFile () (at Assets/Test/Scripts/Test.cs:93)
19
+ Test.OpenTextureFile () (at Assets/Test/Scripts/Test.cs:6)
19
20
  UnityEngine.Events.InvokableCall.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:165)
20
21
  UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:58)
21
22
  UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36)
@@ -26,18 +27,18 @@
26
27
 
27
28
  ```
28
29
 
29
- ### 該当のソースコード
30
+ ### 該当のソースコード(Test.cs)
30
31
 
31
32
  ```C#
32
- public void OpenTextureFile(){
33
+ 1 public void OpenTextureFile(){
33
- OpenFileDialog ofd = new OpenFileDialog ();
34
+ 2 OpenFileDialog ofd = new OpenFileDialog ();
34
- ofd.InitialDirectory = UnityEngine.Application.dataPath;
35
+ 3 ofd.InitialDirectory = UnityEngine.Application.dataPath;
35
- ofd.Filter = "テクスチャ(*.png)|*.png";
36
+ 4 ofd.Filter = "テクスチャ(*.png)|*.png";
36
- ofd.Title = "テクスチャを選択してください";
37
+ 5 ofd.Title = "テクスチャを選択してください";
37
- if (ofd.ShowDialog () == DialogResult.OK) {
38
+ 6 if (ofd.ShowDialog () == DialogResult.OK) {
38
- Debug.Log (ofd.FileName);
39
+ 7 Debug.Log (ofd.FileName);
40
+ 8 }
39
- }
41
+ 9 }
40
- }
41
42
  ```
42
43
 
43
44
  ### 補足情報(FW/ツールのバージョンなど)

1

タイトルを修正しました

2018/02/10 01:57

投稿

apple_pie
apple_pie

スコア25

title CHANGED
@@ -1,1 +1,1 @@
1
- UnityでOpenFileDialogを使用するとッシュす
1
+ UnityでOpenFileDialogを使用するとーが起き
body CHANGED
File without changes