Site Overlay

How to make a LOADING BAR in Unity



Let’s create a progress bar!

● Download the scene:

● Written tutorial by Alan Zucconi:

♥ Support my videos on Patreon:

····················································································

♥ Donate:
♥ Subscribe:

● Website:
● Facebook:
● Twitter:

········································­­·······································­·­····

Edited by the lovely Sofibab.

········································­­·······································­·­····

► All content by Brackeys is 100% free. I believe that education should be available for everyone. Any support is truly appreciated so I can keep on making the content free of charge.

········································­­·······································­·­····
♪ Baby Plays Electro Games

source: https://tim2lead.com

Xem thêm các bài viết về Giải Trí: https://tim2lead.com/category/giai-tri/

46 thoughts on “How to make a LOADING BAR in Unity

  1. Just a little improve, if you put the line "loadingScreen.SetActive(true);
    " before the "StartCoroutine", in the "LoadLevel" method, the panel will appear ALWAYS before the couroutine start, because in my project I try this and must of the time the panel (and obviously the slider) take too long to appear and the start menu was still visible for a tiny but visible time, so whit this little change work like a charm!! Thanks Brackeys, you rock!!! ♥

  2. Dude, you speak very fast. My first language is not english. It is hard to flow through the tutorial. Try to speak slowly in the next tutorials. Thank you!

  3. People keeps telling me how ugly PHP is, because it isn't strongly typed. Tell me to shift my focus to C#, because it is a much stronger language.

    Then I see things like progressText = progress * 100f + "%"; and I throw up a bit in my mouth.

    That, in PHP, would be:
    $progressText = sprintf("%d%s", $progress * 100, "%");

    or

    $progressText = $progress * 100 . "%";

    Now, which is more readable? Which has less room for error? Which is more obvious what is a variable, what is a string, what is a number, what is part of an equation and what is a concatenation of a string?
    Look at that, and tell me again how specifying the variable type when declaring the variable makes C# a superior language!

    I mean, it's a moot point, I do use both….

  4. How do i modify this so i don't have to use your button setup and simply get the progress bar working to load the next scene between a register/login menu and the game scene?

  5. You should be using string formats for percents. It will grab the current UI culture and format it appropriately.

  6. Everything is rigth but when i put my loadind scene into build settings and play and when i click loadlevel it is not loading in showing that scene not loaded

  7. public Slider slider;

    public GameObject loadingScreen;

    public void LoadLevel(int index)

    {

    loadingScreen.SetActive(true);

    StartCoroutine(Loading(index));

    }

    IEnumerator Loading(int index)

    {

    yield return null;

    AsyncOperation operation = SceneManager.LoadSceneAsync(index);

    operation.allowSceneActivation = false;

    while (!operation.isDone)

    {

    float running = Mathf.Clamp01(operation.progress / .9f);

    slider.value = running;

    if (running == 1) { operation.allowSceneActivation = true; }

    yield return null;

    }

    }

  8. Hey! This is so great, by any chance do you know if is achievable with procedural content on the screen to load? 😀 As it just goes to 100% but them it freezes to load the procedural stuff

  9. Hey Can Anyone Help me .. Mine doesn't goes from 0 to .9 it directly Goes to 1 which makes the bar full all the time
    Anyone Please Help Me Out !!

  10. This doesn't work for me, since the loading bar and text will suddenly show 100%, also in build. Instead of showing gradual progress as expected (no metter how fast it is).

  11. Can any1 help me out I am not getting value 0.9 .. it just print value 0 and starts .
    means no increase in value of slider take place it take 2-3 sec at value 0 and load next scene ..
    Anyone ??

  12. Tips for people who don't see the progress bar working is to build the game (standalone build) and test it there, instead of "play" in the editor.

  13. I just want to say a big thanks to you and other content creators sharing what you've learnt. It's really saving me a lot of time and headaches.

  14. I have a problem, when player die game go to some menu scene, there player click play button then go to this tutorial load scene (without button) this load scene instantly run function on start. But still when on menu player clock start button he must wait few second, then he go to load scene for 100ms then go to loaded game scene…. So still menu make feeling like not responding after click play button

  15. You are the best, Brackeys! Myself, meanwhile, am a stupid dumbshit. I had the yield outside the while and couldn't understand why it was freezing >-D

  16. I watched two continuous adds for you, and I'll watch more if it means that I have to learn everything you can teach.

    So, thank you. 🙂

  17. I'm having the same problem that someone else in the comments mentioned… My loading slider (and text) gets super fast to 100% then everything freezes – I've also animations – then I've to wait 10-15 seconds with a frozen loading scene before the new scene actually appears.

Leave a Reply

Your email address will not be published. Required fields are marked *