Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Spawner : MonoBehaviour
- {
- public int spawnInterval; // раз в сколько кадров создаем трубу
- public Vector3 spawnPosition; // в каком месте спавним трубу
- public GameObject pipePrefab; // что создаем
- int timer = 0; // счетчик
- void FixedUpdate()
- {
- timer += 1;
- if(timer >= spawnInterval)
- {
- timer = 0;
- Instantiate(pipePrefab, spawnPosition, pipePrefab.transform.rotation);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement