質問編集履歴
2
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -82,7 +82,9 @@
|
|
82
82
|
|
83
83
|
### 試したこと
|
84
84
|
|
85
|
+
OnCollisionEnter(Collision collision)について調べてみて、
|
85
86
|
|
87
|
+
ifを追加してみましたが、効果音が流れません。
|
86
88
|
|
87
89
|
|
88
90
|
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,14 +36,6 @@
|
|
36
36
|
|
37
37
|
```ここに言語名を入力
|
38
38
|
|
39
|
-
C#
|
40
|
-
|
41
|
-
```
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
### 試したこと
|
46
|
-
|
47
39
|
using UnityEngine;
|
48
40
|
|
49
41
|
|
@@ -52,37 +44,43 @@
|
|
52
44
|
|
53
45
|
{
|
54
46
|
|
55
|
-
|
47
|
+
public AudioClip sound;
|
56
48
|
|
57
|
-
|
49
|
+
private AudioSource audioSource;
|
58
50
|
|
59
51
|
|
60
52
|
|
61
|
-
|
53
|
+
private void OnCollisionEnter(Collision collision)
|
62
54
|
|
63
|
-
|
55
|
+
{
|
64
56
|
|
65
57
|
|
66
58
|
|
67
|
-
|
59
|
+
if (collision.gameObject.name == "Sphere")
|
68
60
|
|
69
|
-
|
61
|
+
{
|
70
62
|
|
71
|
-
|
63
|
+
audioSource.Play();
|
72
|
-
|
73
|
-
}
|
74
|
-
|
75
|
-
else
|
76
|
-
|
77
|
-
{
|
78
|
-
|
79
|
-
audioSource.Stop();
|
80
|
-
|
81
|
-
}
|
82
|
-
|
83
|
-
}
|
84
64
|
|
85
65
|
}
|
66
|
+
|
67
|
+
else
|
68
|
+
|
69
|
+
{
|
70
|
+
|
71
|
+
audioSource.Stop();
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
```
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
### 試したこと
|
86
84
|
|
87
85
|
|
88
86
|
|