20 lines
418 B
C#
20 lines
418 B
C#
|
using UnityEngine;
|
||
|
|
||
|
public class GroundSpawner : MonoBehaviour
|
||
|
{
|
||
|
public GameObject groundPrefab;
|
||
|
public Vector3 nextSpawnPos;
|
||
|
|
||
|
void Start()
|
||
|
{
|
||
|
SpawnGround();
|
||
|
}
|
||
|
|
||
|
// instantiating ground
|
||
|
public void SpawnGround()
|
||
|
{
|
||
|
GameObject temp = Instantiate(groundPrefab, nextSpawnPos, Quaternion.identity);
|
||
|
nextSpawnPos = temp.transform.GetChild(1).transform.position;
|
||
|
}
|
||
|
}
|