Well, you could have the game technically start already (Load the scene), but have there be a loading screen viewed to the player.
In an IEnumerator you can instantiate the objects with small delays between them.
Say something like:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class SpawnCharacters_Handler : MonoBehaviour {
public float SpawnDelay = 0.2f;
public GameObject LoadingScreen_GUI;
public List Characters;
void Start()
{
LoadingScreen_GUI.SetActive(true); // You can keep it active by default in the end, but this way you can keep it disables whilst working.
StartCoroutine(SpawnCharacters()); // Activate the Spawning of your Characters
}
private IEnumerator SpawnCharacters()
{
// Run through all of your Characters
foreach (GameObject character in Characters)
{
// Spawn a character and wait for "SpawnDelay" in seconds, Rinse and Repeat
Instantiate(character, transform.position, Quaternion.identity);
yield return new WaitForSeconds(SpawnDelay);
}
LoadingScreen_GUI.SetActive(false); // Get it out of the way, feel free to use Epic Fades and what not.
}
}
Don't worry too much about the details like where you spawn the characters, you'll know that better than I do ;)
It's just an example, but it comes down to having to spawn the characters at runtime and give the player the illusion they're still waiting patiently.
You'll have to sacrifice: "Less of a framedrop / spike" => "Longer loading times".
The size of the sacrifice depends on how intense the cycle becomes.
Aka, more characters, more loading time if you want to keep the spike just as low. :)
I hope that helps, there may be other ways, but this is a good trick :3
↧