How to make a LOADING BAR in Unity
Why Stack Overflow recommends it
Stack Overflow users link it when someone needs a simple Unity loading bar or progress slider driven from code.
Recommended by 2 people across 2 different months, 2018 to 2019.
What it is
A Brackeys Unity tutorial that walks through building a loading screen with a progress bar using a UI slider and asynchronous scene loading. It is a beginner-friendly screencast with a downloadable starter scene and a linked written guide by Alan Zucconi.
What people said
Recommends Nicholas Bucher · 2019-03 · Stack Overflow · on “How to make a simple progress bar”
For a progress bar You can use the Unity scrollbar object to make what you're looking for. There's a good tutorial on it here [this video] . Essentially, you add a scrollbar object to your canvas, and then change the slider value from code. For scrolling textures If you want a scrolling texture on your progress bar, then you can animate an image placed on the slider. If you don't want to animate it by hand, then it's a little more complicated. Ideally you could set the texture offset of the image in code to get it to scroll, but after looking it up I don't think that Unity allows you to do that on non-3D objects. If you still want it to scroll and don't want to make a hand-drawn animation for it,
Recommends Enrico Cortinovis · 2019-12 · Stack Overflow · on “Unity - Loading bar often goes from 0% to 100% directly, while loading (C#)”
I made a loading bar following Brackeys [LINK] ' tutorial here [this video] (and have changed a few things later). I noticed that when I load a level, and my loading bar comes out, it first shows 0% , waits, then directly 100% - without intermediate values !. I'm guessing it could be due to some lag that occurs because the game is already using a lot of hardware, and hasn't left enough power for the rest of the processes, because I tried making it load while doing other things at the same time. Here is the code that loads the level and changes the slider's value : public void LoadLevel(int sceneIndex) { StartCoroutine(StartFadeThenLoadLevel(sceneIndex)); } IEnumerator StartFadeThenLoadLevel(int s
Cites Chico3001 · 2018-04 · Stack Overflow · on “Unity Android: How to preload scenes in cache”
Short answer is you can't, the first time your app runs it will create its own cache [LINK] and that takes time, But you can create a loading screen and load your scenes asynchronously, there are a lot of tutorials about that [LINK] using System.Collections; using UnityEngine; using UnityEngine.SceneManagement; public class Example : MonoBehaviour { void Update() { //Press the space key to start coroutine if (Input.GetKeyDown(KeyCode.Space)) { //Use a coroutine to load the Scene in the background StartCoroutine(LoadYourAsyncScene()); } } IEnumerator LoadYourAsyncScene() { // The Application loads the Scene in the background at the same time as the current Scene. //This is particularly good f
Cites Junaid Pathan · 2018-09 · Stack Overflow · on “Scale gameobject on just one side”
You can use Slider for the purpose. I was designing a Loading bar for which I needed to Increase width of the loader according to the download that is progressed. You can disable its handle, and use custom Sprite for loading fill percentage. You can also use custom Sprite for background. To use Slider, go to Menu Bar -> GameObject -> UI -> Slider. Or instead You can Add a Slider Component from the Inspector for the GmaeObject you want (Select the GameObject you want to add Slider -> In the Inspector click Add Component -> UI -> Slider. Now Set Fill Rect and other Options). You can set Slider from Left to Right, Right to Left, Bottom to Top, or Top to Bottom. In the Script using UnityEngine.U