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 /
avatar image
0
Question by quadack · Apr 02, 2018 at 11:08 PM · bugsnewfreezingrandom gen

HELP! my game is freezing while trying to instantiate objects...

Hi, thanks for the help... Okay, I am making a maze-like game, and I have come across an issue. The game is randomly generated. I do it here in my code on the start of the scene.

 void Start () {
         loadingt.enabled = false;
         loadingi.enabled = false;
         loadingpr = false;
         destroy2 = false;
         data.dfloor = 1;
         data.loading = true;
         data.totalkey = 0;
         data.totalchest = 0;
         RenderSettings.ambientLight = colors[(Random.Range(0,4))];
         tempchest = 0;
         realxsize = 2;
         realysize = 2;
         data.xsize = realxsize;
         data.ysize = realysize;
         optimize();
         data.loading = false;
         
 
     }

If you need a more specific look at a function then ask. For the optimize function, it is

  public void optimize()
     {
         CreateWalls();
         namewall();
         special();
 
 
     }

and I actually refrence 2 more funtions as well, but like I said, ask if you need them. Okay, when I start the scene for the first time it loads great. hoooowever, it freezes and crashes my engine when trying to reload the scene mid game, let me explain, When you get to the end, you trigger a regeneration of the maze. here,

  void Update()
     {
         if (data.loading == true)
         {
 
 
             StartCoroutine(wait());
             loadingt.enabled = true;
             loadingi.enabled = true;
             loadingpr = true;
             data.dfloor++;
             realysize++;
             realxsize++;
             data.xsize = realxsize;
             data.ysize = realysize;
             StartCoroutine(wait());
             destroy();
             StartCoroutine(wait());
             CreateWalls();
             StartCoroutine(wait());
 
 
 
 
 
         }

Now the issue is when I go to regenerate the game it just freezes. I have narrowed it down to just the CreateWalls() function, yet, even with the Waits, it still just crashes... HELP!

Comment
Add comment · Show 1
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
avatar image mgear · Apr 03, 2018 at 06:22 AM 0
Share

this line doesn't wait the execution inside Update loop, StartCoroutine(wait());

if you need that to happen, put all that code inside coroutine, and then call this to wait for that line: yield return StartCoroutine(wait());

0 Replies

· Add your reply
  • Sort: 

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

77 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

Related Questions

Unity freezes after adding a new script 1 Answer

The Pause of Death - Unity's system freeze causes many issues. 0 Answers

New User Questions 1 Answer

Where do I start with unity? 3 Answers

Why is my game slow when i export it to Windows? 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