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 /
This question was closed Nov 18, 2016 at 08:38 PM by Jay1234 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Jay1234 · Nov 18, 2016 at 07:40 PM · loadingloading screenprogress-bar

I'm trying to create a progress loading bar and i keep getting the error message, "NullReferenceException: Object reference not set to an instance of an object". I'm kinda new to Unity, what am i doing wrong, am i missing something?

using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; using UnityEngine.UI;

public class loadingBar : MonoBehaviour {

 AsyncOperation ao;
 public GameObject loadingScreenBG;
 public GameObject loadingLogo;
 public Image progBar;
 public Text loadingText;

 void Start()
 {
     StartCoroutine(loadmainScene());
     StartCoroutine(LoadLevelwithRealProgress());
 }

 void Update()
 {
     
 }

 IEnumerator loadmainScene()
 {
     loadingScreenBG.SetActive(true);
     loadingLogo.SetActive(true);
     yield return new WaitForSeconds(1);
     progBar.gameObject.SetActive(true);
     loadingText.gameObject.SetActive(true);
     loadingText.text = "Loading. . .";
 }

 IEnumerator LoadLevelwithRealProgress()
 {
     yield return new WaitForSeconds(1);

     ao = SceneManager.LoadSceneAsync(1);
     ao.allowSceneActivation = true;
     
     while(!ao.isDone)
     {
         progBar.fillAmount = ao.progress;
         Debug.Log(ao.progress);
         yield return null;
     }
 }

}

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

  • Sort: 
avatar image
-1
Best Answer

Answer by Jay1234 · Nov 18, 2016 at 08:37 PM

I figured it out, stupid me lol. I was asking it to load Scene 1 but i forgot to add Scene 1 in the build settings..... such a silly mistake lol..

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

Follow this Question

Answers Answers and Comments

78 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

Related Questions

How to check is the game loaded in index.html? 1 Answer

How to predict/Estimate scene loading time before loading the scene?,A quick and/or reliable way to predict/estimate scene loading time? 0 Answers

Gear VR Loading screen freeze 0 Answers

Loading Bar For Each Canvas in a Scene 1 Answer

[ISSUE] Delay after splash screen 5 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