Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by ExcellS23 · Apr 21, 2017 at 02:31 PM · scene-loadingloadlevelmemory usageloadlevelasyncram

Scene Loading: Extremely RAM usage and Long Scene Loading Time (4mins).

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<Button>();
     cameraViewYPos[0] = -.77f;
     cameraViewYPos[1]= -.41f;
     cameraViewYPos[2]= -.11f;
     viewButtons = new Button[3];
     viewButtons[0] = GameObject.FindGameObjectWithTag("CloseView").GetComponent<Button>();
     viewButtons[1] = GameObject.FindGameObjectWithTag("RegView").GetComponent<Button>();
     viewButtons[2] = GameObject.FindGameObjectWithTag("WideView").GetComponent<Button>();
     
     viewSizes[0] = 3.3f;
     viewSizes[1] = 4f;
     viewSizes[2] = 4.7f;
     theCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
     camParentObj = GameObject.FindGameObjectWithTag("CameraContainer");
     //spawnManager = FindObjectOfType<EnemySpawnManager>();
     buttonScript = FindObjectOfType<ButtonScript>();
     //BBS = FindObjectOfType<BossBehaviorScript>();
     sloMo = GetComponent<SlowMotion>();
     enemynumTxtBox = GameObject.FindGameObjectWithTag("EnemyCounter").GetComponent<Text>();
     SettingsMenu = GameObject.FindGameObjectWithTag("SettingsCanvas");
    PauseCanvas = GameObject.FindGameObjectWithTag("PauseCanvas");
    theMusicAudioComponent = 
    GameObject.FindGameObjectWithTag("MusicManager").GetComponent<AudioSource>();
    soundFxPlayer = 
    GameObject.FindGameObjectWithTag("AudioSoundFx").GetComponent<AudioSource>();
     togglechkNum = PlayerPrefs.GetInt("ToggleOn");
     theChosenView = PlayerPrefs.GetInt("selectedview");
     musicVal = PlayerPrefs.GetFloat("MusicSettings");
     fxVal = PlayerPrefs.GetFloat("FxSettings");
 
         //enemyCounter = startingEnemyCount;
         MusicValue(musicVal);
         FxValue(fxVal);
         enemyCounter = 0;
         enemynumTxtBox.text = "0" + enemyCounter;
         SetUserCamPos(theChosenView); //Set the cam position.
         SettingsMenu.SetActive(false);
         PauseCanvas.SetActive(false);
         //sw.Stop();
         //print("GMS Start Time" + ((float)sw.ElapsedMilliseconds / 1000f));
    }
             
     // Update is called once per frame
     void Update () {
              
         if(_startBossSpawnMinions){
             CheckMinionAmounts();
         }
     }
    
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by ExcellS23 · Apr 26, 2017 at 10:42 AM

Figured it out by myself... It had absolutely nothing to do with my script.. It was related to the asset dependencies of the scenes. I had a prefab that had MANY references to sprites that were related to animations that I didn't not need on that particular level. I also lowered the texture sizes of some of my sprites because they were ridiculous (some were 20-30mb a piece). After making these changes, my load time went from 4 mins(and/or a auto system reboot) to 10 "SECONDS". I had someone try to charge me $1400 to fix something this simple... Main lesson, believe in your self, keep learning and keep Tinkering!!!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

99 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Loading new scene in unity 2D 0 Answers

SteamVR_LoadLevel() freezes when done loading in builds only 1 Answer

Objects don't instantiate after level reload. 0 Answers

OPEN WORLD GAME QUESTION 2 Answers

First scene loads twice 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges