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 Rembo4Fight · Jun 05, 2018 at 12:11 PM · scripting problemscene-loadingload scenelevel load

Scene is loading in Game Mode, but not in the build. Why?

Hello, I'm making a 2D game, where is I think not so many objects to make cause the problems in loading another scene, but in the build, the second level is not loading, except if I try to play the game in Unity program in Game-Mode it works fine and quickly.

What can cause the problems? Any pieces of advice?

It's strange because in game-mode it loads fine, but in the build, it just stops the process without any errors!

P.S. I even tried to delete about all the objects in the scene before it will load another level, and the problem still exists even its loading the scene now, but very slow, but the level looks like just a camera on each other when it's loading.

Comment
Add comment · Show 3
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 MagnaDever · Jun 05, 2018 at 01:42 PM 0
Share

attach code please

avatar image Rembo4Fight MagnaDever · Jun 05, 2018 at 02:25 PM 0
Share

The main part is in the end.

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Scene$$anonymous$$anagement;

 public class $$anonymous$$eyCodeTrigger : $$anonymous$$onoBehaviour {
 
     public $$anonymous$$aterial main$$anonymous$$at;
     public $$anonymous$$aterial new$$anonymous$$at;
 
     public bool trigger;
     public bool is$$anonymous$$atNew;
 
     public float thres;
     public float max;
 
     static float t;
 
     public GameObject theObject;
     public GameObject text;
     public GameObject $$anonymous$$eyCodePanel;
 
     public GameObject deleteObjects;
 
     void Start () {
         theObject.GetComponent<Collider2D> ();
 
         is$$anonymous$$atNew = false;
 
         thres = new$$anonymous$$at.GetFloat ("_Threshold");
     }
 
     void Update () {
         if (is$$anonymous$$atNew == false) 
         {
             theObject.GetComponent<SpriteRenderer> ().material = main$$anonymous$$at;
             $$anonymous$$eyCodePanel.gameObject.SetActive (false);
         }
 
 
         if (is$$anonymous$$atNew == true) 
         {
             t = 0.75f * Time.time;
             thres = $$anonymous$$athf.PingPong (t, max) + 0.2f;
 
             new$$anonymous$$at.SetFloat ("_Threshold", thres);
 
             theObject.GetComponent<SpriteRenderer> ().material = new$$anonymous$$at;
         }
 
         if (is$$anonymous$$atNew == true && Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.E)) 
         {
             $$anonymous$$eyCodePanel.gameObject.SetActive (true);
         }
 
         if (CodePanel.playerCode == CodePanel.correctCode) 
         {
             Destroy (deleteObjects);
             StartCoroutine (WaitSec ());
         }
 
     }
 
     void OnTriggerEnter2D(Collider2D theObject)
     {
         if (theObject.gameObject.tag == "Player") 
         {
             is$$anonymous$$atNew = true;
             text.gameObject.SetActive (true);
         }
     }
 
     void OnTriggerExit2D(Collider2D theObject)
     {
         is$$anonymous$$atNew = false;
         text.gameObject.SetActive (false);
     }
 
     IEnumerator WaitSec()
     {
         yield return new WaitForSeconds (1);
         Scene$$anonymous$$anager.LoadScene ("Level-2");
         yield return null;    
     }
 }
 
avatar image MagnaDever Rembo4Fight · Jun 05, 2018 at 03:42 PM 0
Share

Please attach screen of build settings

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by MagnaDever · Jun 05, 2018 at 03:50 PM

Try use "LoadSceneAsync"

Comment
Add comment · Show 3 · 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
avatar image Rembo4Fight · Jun 05, 2018 at 06:24 PM 0
Share

I'm about to make it, but I'm not sure how.

Because I want to start loading the second level in the middle of the first level by trigger/checkpoint

  • don't know how correctly I made this if know how to make it please try to help.*

    using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Scene$$anonymous$$anagement;

    public class CheckPointSystem : $$anonymous$$onoBehaviour {

       public Level$$anonymous$$anager level$$anonymous$$anager;
         private BoxCollider2D myCollider;
     
         public bool asyncLoaderStart;
         public bool loaded = false;
         public bool startLoadNewLevel = false;
     
         void Start () {
             myCollider = GetComponent<BoxCollider2D> ();
             level$$anonymous$$anager = FindObjectOfType<Level$$anonymous$$anager> ();
         }
     
         void OnTriggerEnter2D(Collider2D col)
         {
             if (col.tag == "Player") 
             {
                 myCollider.enabled = false;
                 level$$anonymous$$anager.currentCheckpoint = gameObject;
                 Debug.Log ("Activated Checkpoint " + transform.position);
                 if (asyncLoaderStart == true) 
                 {
                     StartCoroutine (AsyncLoad ());
                 }
             }
         }
     
         IEnumerator AsyncLoad()
         {
                 AsyncOperation asyncLoad = Scene$$anonymous$$anager.LoadSceneAsync ("Level-2");
                 asyncLoad.allowSceneActivation = false;
     
                 while (!asyncLoad.isDone) 
                 {
                     yield return null;
                 }
     
             if (asyncLoad.isDone) 
             {
                 loaded = true;
             }
     
             if (startLoadNewLevel == true && loaded == true) 
             {
                 asyncLoad.allowSceneActivation = true;
             }
         }
    
avatar image MagnaDever Rembo4Fight · Jun 05, 2018 at 06:30 PM 0
Share

It's normal situation. I need screen of build settings window

avatar image Rembo4Fight MagnaDever · Jun 05, 2018 at 06:38 PM 0
Share

Here you go

1.jpg (202.4 kB)
avatar image
0

Answer by abuelitovip · Jun 05, 2018 at 07:23 PM

Start can you test in unity editor the first scene of build list?

other option is disable the second level of build and test, if the game don´t jump to the next scene, the problem is the first scene on the build list.

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

208 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

LoadScene will only work from first scene 1 Answer

LoadScene not working 0 Answers

How to fix Loading Screen? 0 Answers

Is there any way to recreate the executable? 0 Answers

Hello , I will like a little bit of help regarding a game that I create. 0 Answers


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