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

質問編集履歴

1

当該スクリプトのクラス名を追記。他スクリプトを追記。

2019/05/08 09:29

投稿

SugKim
SugKim

スコア10

title CHANGED
File without changes
body CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  ##Script
7
7
  ```C#
8
+ public class BarObstScript : MonoBehaviour
9
+ {
8
10
  public float bar_speed;
9
11
  int scoreNum = 0; //score用変数
10
12
 
@@ -27,7 +29,34 @@
27
29
  Destroy(gameObject);
28
30
  }
29
31
  }
32
+ }
30
33
  ```
34
+
35
+ ##Script2
36
+ 原因がありそうな他のスクリプトは下記ぐらいです。
37
+ こちらはプレハブ化したbarオブジェクトを一定間隔で生成しようとしてます。
38
+ ```C#
39
+ public class BarObstReplicScript : MonoBehaviour
40
+ {
41
+ public GameObject BarObst;
42
+
43
+ void Start()
44
+ {
45
+ InvokeRepeating("SpawnBar", 0f, 1.4f);
46
+ }
47
+
48
+ void Update()
49
+ {
50
+
51
+ }
52
+
53
+ void SpawnBar()
54
+ {
55
+ Instantiate(BarObst, new Vector3(transform.position.x, transform.position.y, transform.position.z), transform.rotation);
56
+ }
57
+ }
58
+ ```
59
+
31
60
  ###開発環境
32
61
  macOS Mojave 10.14.4(18E226)
33
62
  Unity 2018.3.11f1