Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class preFab : MonoBehaviour {
- public GameObject barreiraPrefab;
- public float rateSpawn;
- public float currentTime;
- // Use this for initialization
- void Start () {
- currentTime = 0;
- }
- // Update is called once per frame
- void Update () {
- currentTime += Time.deltaTime;
- if (currentTime >= rateSpawn)
- {
- currentTime = 0;
- GameObject tempPrefab = Instantiate(barreiraPrefab) as GameObject;
- tempPrefab.transform.position = new Vector3(transform.position.x, tempPrefab.transform.position.y, tempPrefab.transform.position.z);
- }
- }
- }
Add Comment
Please, Sign In to add comment