Page 92 - MODUL PEMROGRAMAN 2D DAN 3D FIXxxxxxxxxxxxx_Neat
P. 92
25. Hapus pipe yang berada di Hierachy yang berwarna tulisan biru.
26. Tahap selanjutnya, buka folder script dan buat script baru dengan nama
Generate dan tuliskan scriptnya.
using UnityEngine;
using System.Collections;
public class Generate : MonoBehaviour {
public GameObject pipe;
// Use this for initialization
void Start () {
InvokeRepeating ("panggil", 1f, 1.5f);
}
// Update is called once per frame
void Update () {
}
void panggil()
{
Instantiate (pipe);
}
}
78