So I have 2 scenes, the main menu, and the game. When I press play on the engine and then play in the menu I can load into the game. The problem is that I am trying to instantiate objects depending on the time that the game started. I load into the game and the enemies are not spawning. Anything helps!
Here is my instantiate script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class JumpSpawn : MonoBehaviour
{
public Transform[] Spawns;
public GameObject Enemy;
private float timetospawn = 0.5f;
void FixedUpdate()
{
if (Time.time == timetospawn)
{
spawnenemy();
timetospawn = timetospawn + 0.5f;
}
}
void spawnenemy()
{
int randomIndex = Random.Range(0, Spawns.Length);
for (int i = 0; i < Spawns.Length; i++)
{
if (randomIndex == i)
{
GameObject clone = Instantiate(Enemy, Spawns*.position, Quaternion.identity);*
}
}
}
}
Ask me if you need anymore details!