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

質問編集履歴

3

注釈を追加

2020/01/13 10:53

投稿

howto_o
howto_o

スコア8

title CHANGED
File without changes
body CHANGED
@@ -168,6 +168,7 @@
168
168
 
169
169
  ```
170
170
 
171
+ ※コードで仕込んだログ結果も。
171
172
  ![イメージ説明](67f2f9e37f9e4e990e1d9f14e8eee3b3.png)
172
173
 
173
174
  ![イメージ説明](a9a9529194a000a2ce4fc1341524c755.png)

2

コードを修正

2020/01/13 10:53

投稿

howto_o
howto_o

スコア8

title CHANGED
File without changes
body CHANGED
@@ -23,18 +23,18 @@
23
23
  using System.Collections;
24
24
  using System.Collections.Generic;
25
25
  using UnityEngine;
26
- using UnityEngine.UI; // UnityのGUIを変更するのに必要
26
+ using UnityEngine.UI;
27
27
 
28
28
  public class Judge : MonoBehaviour
29
29
  {
30
- public GameObject p1_G; // 外部からものを取得してくる
30
+ public GameObject p1_G;
31
31
  public GameObject p1_C;
32
32
  public GameObject p1_P;
33
33
  public GameObject p2_G;
34
34
  public GameObject p2_C;
35
35
  public GameObject p2_P;
36
- public Text text_result; // using UnityEngine.UIによってTextが使えるようになる
36
+ public Text text_result;
37
- public GameObject win_effect; // パーティクルを追加するため
37
+ public GameObject win_effect;
38
38
  public GameObject lose_effect;
39
39
  // Start is called before the first frame update
40
40
  void Start()
@@ -49,23 +49,22 @@
49
49
  }
50
50
  public void OnClick()
51
51
  {
52
- // 何が表示されているかを確認
52
+ // MeshRenderの状態を見て何が表示されているかを確認
53
- // クリックされた時にMeshRenderの状態を確認する処理
54
- Renderer ren_p1_G = p1_G.GetComponent<Renderer>(); // Renderer型の変数にComponentのMeshRenderを持ってくる
53
+ Renderer ren_p1_G = p1_G.GetComponent<Renderer>();
55
54
  Renderer ren_p1_C = p1_C.GetComponent<Renderer>();
56
55
  Renderer ren_p1_P = p1_P.GetComponent<Renderer>();
57
56
  Renderer ren_p2_G = p2_G.GetComponent<Renderer>();
58
57
  Renderer ren_p2_C = p2_C.GetComponent<Renderer>();
59
58
  Renderer ren_p2_P = p2_P.GetComponent<Renderer>();
60
- // AR_Cameraに移るオブジェクトは2つ
59
+
61
- // 何を出したのかを文字列で取得する
62
60
  // それぞれのカードを入れる変数を初期化
63
61
  string result_p1 = "";
64
62
  string result_p2 = "";
63
+
65
64
  // 何が表示されているか判定
66
- if(ren_p1_G.enabled == true) // レンダリングにグーが選ばれていた場合
65
+ if(ren_p1_G.enabled == true) // player1にグーが選ばれていた場合
67
66
  {
68
- result_p1 = "G"; // 文字列をグーにする
67
+ result_p1 = "G";
69
68
  Debug.Log("result_p1 is %s \n" + result_p1);
70
69
  Debug.Log("result_p2 is %s \n" + result_p2);
71
70
  }
@@ -110,8 +109,8 @@
110
109
  else if (result_p2 == "C")
111
110
  {
112
111
  text_result.text = "p1の勝ち";
113
- Instantiate(win_effect, p1_G.transform.position, p1_G.transform.rotation); // 何のパーティクルをどこに出すか指定
112
+ Instantiate(win_effect, p1_G.transform.position, p1_G.transform.rotation);
114
- Instantiate(lose_effect, p2_C.transform.position, p2_C.transform.rotation); // 負けた側
113
+ Instantiate(lose_effect, p2_C.transform.position, p2_C.transform.rotation);
115
114
  }
116
115
  else if (result_p2 == "P")
117
116
  {

1

タイトルの変更

2020/01/13 10:17

投稿

howto_o
howto_o

スコア8

title CHANGED
@@ -1,1 +1,1 @@
1
- [Unity][Instantiate関数]認識したマーカー上にエフェクト(パーティクル)を表示できない
1
+ Unity認識したARマーカー上にエフェクト(パーティクル)を表示できない
body CHANGED
File without changes