- Home /
How do I code just a Loading scene with text and pictures in unity3d c#
I know how to load a scene. I need a loading scene for cell phones. I don't want input key when loading scene done loading. I want the scene to just switch over on it own. I going to add a picture too in the loading scene. I just need help getting started. An example of the loading scene would be something like this :
Loading ....
Behind loading text is a picture showing .
What I understood is , you need to show a loading scene with "loading text"+"a picture" while a scene is loading. If that is your requirement you could use the following solution:
Create an image (or even a plane). Put the text into that (loading...) or put both image and text into a single gameobject.
[here I have used "UI-image" and put the "UI-text" into the image]
Then,
public Image img;
void Start ()
{
img.gameObject.SetActive(false);
}
// call StartCoroutine(abc()); where you need the scene to load.
IEnumerator abc()
{
img.gameObject.SetActive(true);
yield return new WaitForSeconds(1.5f);
Scene$$anonymous$$anager.LoadSceneAsync("scene1");
}
Hope this will help. Ask for any other requirement
Happy coding :)
Answer by Cynikal · Aug 10, 2016 at 02:37 PM
A simple solution using NGUI's Progress Slider:
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class IntroScene_Loader : MonoBehaviour
{
private UISlider progress;
// Use this for initialization
void Start ()
{
progress = GameObject.Find("LoadProgressBar").GetComponent<UISlider>();
StartCoroutine(loadAsync("MainGameScene"));
}
private IEnumerator loadAsync(string levelName)
{
AsyncOperation operation = SceneManager.LoadSceneAsync(levelName);
while (!operation.isDone)
{
yield return operation.isDone;
progress.value = operation.progress;
}
}
}
This way, when the "Preloader" scene is loaded, it's an Asynchronous load. When the scene is loaded, it'll just switch over.
You could play with it a bit more, then when the scene is loaded, wait for a keypress, etc.
Answer by MuffinMan101010 · Aug 10, 2016 at 12:57 PM
I normally make a loading scene. I start in the menu, click play. I open my loading scene, a few seconds later I load my game scene.
I would probably put that under comments... kinda short to be considered an answer xD. But im not gonna downvote you :p
Your answer
Follow this Question
Related Questions
Is there a perferred method for handling scene loading? 1 Answer
How to select scene based on device screen size? 1 Answer
Loading Screen? 6 Answers
Function deleting string by itself. 0 Answers
How can I make a loading screen with LoadSceneAsync 2 Answers