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

質問編集履歴

1

新たに試したソースコードの記載

2018/07/25 09:48

投稿

Asyet_
Asyet_

スコア8

title CHANGED
File without changes
body CHANGED
@@ -28,6 +28,63 @@
28
28
  }
29
29
  ```
30
30
 
31
+ ### 追加:新たに試したソースコード
32
+
33
+ ```C#
34
+ using System.Collections;
35
+ using System.Collections.Generic;
36
+ using UnityEngine;
37
+
38
+ public class PfTimeInsta : MonoBehaviour {
39
+
40
+ // 生成したいPrefab
41
+ public GameObject UpBullet;
42
+
43
+ public Transform motherTf;
44
+
45
+ bool Shootstate = true;
46
+
47
+ public float timeOut = 3;
48
+ private float timeTrigger;
49
+
50
+
51
+ void Start()
52
+ {
53
+
54
+ }
55
+
56
+ void Update()
57
+ {
58
+ if (Shootstate == true)
59
+ {
60
+
61
+ if (Time.time > timeTrigger)
62
+ {
63
+
64
+ Instantiate(UpBullet);
65
+ UpBullet.transform.position = motherTf.position;
66
+
67
+ timeTrigger = Time.time + timeOut;
68
+
69
+ }
70
+ }
71
+ }
72
+
73
+ public void StopShoot()
74
+ {
75
+ Shootstate = false;
76
+ }
77
+
78
+ public void StartShoot()
79
+ {
80
+ if (Shootstate == false)
81
+ {
82
+ Shootstate = true;
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
31
88
  ### 試したこと
32
89
 
33
90
  両名の環境でGame実行画面のStatsタブをONにしてビルド結果実行中のStatisticsを確認したところ、「Saved by batching」「Tris」「Verts」などの値に大きな差があることがわかりました。