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

質問編集履歴

2

試したことの追加

2021/01/04 03:38

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -61,4 +61,7 @@
61
61
 
62
62
  }
63
63
 
64
- }
64
+ }
65
+
66
+ 試したこと
67
+ 違うオブジェクトを隣に配置して表示されるか確認したところ、違うオブジェクトは表示されて、写真のオブジェクトは表示されませんでした。

1

コードの追加

2021/01/04 03:38

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,64 @@
1
- unityでオブジェクトが右から左に流れていくというものを作っています。
1
+ unityでが右から左に流れていくというものを作っています。
2
2
  ゲームを再生してScene画面で確認してみたところ動きはうまくいっています。
3
3
  しかし肝心のオブジェクトが映っていません。どうすればよいでしょうか?
4
4
  下の写真のような状態です。回答お願いします。
5
- ![![イメージ説明](05c6cdd05c9cc71fdfcd2a05544e7a2a.png)](835fbe0b5a546b1e43b7968d92efbc76.png)
5
+ ![![イメージ説明](05c6cdd05c9cc71fdfcd2a05544e7a2a.png)](835fbe0b5a546b1e43b7968d92efbc76.png)
6
+
7
+ 動きを加えるスクリプトのMoveWallのコード
8
+ using System.Collections;
9
+ using System.Collections.Generic;
10
+ using UnityEngine;
11
+
12
+ public class Movewall : MonoBehaviour
13
+ {
14
+ public float speed;
15
+ // Start is called before the first frame update
16
+ void Start()
17
+ {
18
+
19
+ }
20
+
21
+ // Update is called once per frame
22
+ void Update()
23
+ {
24
+ transform.position -= new Vector3(speed, 0f) * Time.deltaTime;
25
+ }
26
+
27
+ }
28
+
29
+ ============================================================================
30
+ 壁を複数生成させるスクリプトのRepetitionWallのコード
31
+ using System.Collections;
32
+ using System.Collections.Generic;
33
+ using UnityEngine;
34
+
35
+ public class RepetitionWall : MonoBehaviour
36
+ {
37
+ public float intervalMin,intervalMax;
38
+
39
+ public float instanceTime;
40
+
41
+ public GameObject graywall;
42
+ // Start is called before the first frame update
43
+ void Start()
44
+ {
45
+
46
+ }
47
+
48
+ // Update is called once per frame
49
+ void Update()
50
+ {
51
+ if(instanceTime <= 0)
52
+ {
53
+ GameObject newwall = Instantiate(graywall);
54
+ newwall.transform.position = new Vector3(10f,-2f,-12);
55
+ instanceTime = Random.Range(intervalMin, intervalMax);
56
+ }
57
+ else
58
+ {
59
+ instanceTime -= Time.deltaTime;
60
+ }
61
+
62
+ }
63
+
64
+ }