質問編集履歴

1

コードを追加しました

2017/06/10 01:22

投稿

Nippun
Nippun

スコア1147

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,43 @@
4
4
 
5
5
  ```
6
6
 
7
+ public class Script : MonoBehaviour {
8
+
9
+
10
+
11
+ private float timer = 0.0f;
12
+
13
+ public GameObject Prefab;
14
+
15
+ public GameObject a;
16
+
17
+
18
+
19
+ void Update () {
20
+
21
+
22
+
23
+ timer += Time.deltaTime;
24
+
25
+ if(timer >= 2){
26
+
27
+ timer = 0.0f;
28
+
29
+ Vector3 offset = new Vector3 (0, 0, 0);
30
+
31
+ a = Instantiate (Prefab, transform.position + offset, transform.rotation) as GameObject;
32
+
33
+ if (timer >= 4) {
34
+
7
- gameObject.GetComponent<Renderer>().material.color = Color.red;
35
+ a.GetComponent<Renderer> ().material.color = Color.red;
36
+
37
+ }
38
+
39
+ }
40
+
41
+ }
42
+
43
+ }
8
44
 
9
45
  コード
10
46