Hi guys, I am almost done with my project, but I am running into a major snag. When I try to use SceneManager.LoadSceneAsync("stageName") from an almost "EMPTY" (one script) game scene, it takes a Ridiculous amount of time and RAM to load one of my game scenes.
This doesn't happen when I just load stages via the editor, it has a quick load time and no excessive RAM use. I don't have a lot going on in them. I just use a Master Script Obj that holds all my scripts (Game Manager, Music Manager, and Special Modes) to find and reference all the UI objects and components so I don't have to manually place them in (I have 90+ stages).
I have MP3 and Wav audio, but I made sure I placed them in the Resources folder and ensured that changed the option from Decompress on load to Streaming and Vorbis Compression. I have tried flushing the memory with an empty game scene but that doesn't work either. I am stuck guys... Below is a "small" example of my GameManager script.
using UnityEngine;
using System.Collections;
using System.Diagnostics;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour {
private ButtonScript buttonScript;
private EnemySpawnManager spawnManager;
private SlowMotion sloMo;
private GameObject camParentObj;
public Button vibrateButton;
private Camera theCamera;
public int selectedBoss;
public int enemyCounter;
public int startingEnemyCount;
private int pauseChkNum; //if 0 pause is off. if 1 pause is on.
private int theChosenView;
private int togglechkNum;
private float[] viewSizes = new float[3];
private float[] cameraViewYPos = new float[3]; //used to adjust screen upon changing camera view.
private float fxVal;
private float musicVal;
public Image pauseMenu;
public Text enemynumTxtBox;
public Button[] viewButtons;
public GameObject SettingsMenu;
public GameObject PauseCanvas;
public GameObject[] onOffText;
public AudioSource theMusicAudioComponent;
public AudioSource soundFxPlayer;
//private BossBehaviorScript BBS;
private bool _settingsIsActive;
public bool _startBossSpawnMinions = false; //used to keep track of when to to start the boss moving again.
public bool _ispaused = false;
void Start(){
//Stopwatch sw = new Stopwatch();
//sw.Start();
onOffText = new GameObject[2];
onOffText[0] = GameObject.FindGameObjectWithTag("ONTXT");
onOffText[1] = GameObject.FindGameObjectWithTag("OFFTXT");
vibrateButton =
GameObject.FindGameObjectWithTag("VibrateToggleButton").GetComponent
↧