05-07-2020, 09:03 PM
(This post was last modified: 05-07-2020, 09:20 PM by PretzelStudios.)
Ok Cross-checking that thread I did manage to figure this out.
For anyone in the future here is my code to make this work.
Hope it helps
For anyone in the future here is my code to make this work.
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using FluffyUnderware.Curvy.Controllers;
using FluffyUnderware.Curvy;
public class VehicleSpawner : MonoBehaviour
{
private SplineController sc;
public GameObject[] vehicles;
public float spawnInterval;
public CurvySpline road;
private void Start()
{
StartCoroutine(SpawnVehicles());
}
private IEnumerator SpawnVehicles()
{
while (true)
{
int index;
index = Random.Range(0, vehicles.Length - 1);
Instantiate(vehicles[index]);
sc = vehicles[index].GetComponent<SplineController>();
sc.Spline = road;
yield return new WaitForSeconds(spawnInterval);
}
}
}
Hope it helps