0
\$\begingroup\$

I am using Unity in my Android app. When the app opens, I show the user data in the Unity scene. User data contains texts and images.

In order to load this data in the scene, I make a lot of UnityPlayer.UnitySendMessage(GameObject,Function,Params) calls to many C# scripts in Unity from Android. Each of these calls performs a specific task like loading an image, creating a text, applying the text font etc.

Problem is that the loading of this data right now looks incremental (if that's the right word). So the text is visible first and after a fraction of a second the image shows. Some text effects show later. This looks ugly.

How can I make all the UI elements load at the same time even if it takes some time? Is there a way to freeze the scene before each game object is ready to be drawn?

\$\endgroup\$
  • \$\begingroup\$ You could choose to show a loading animation until your app finishes loading the last image, or until you send an "Okay, ready to reveal" message to trigger your scripts to switch to displaying the now-fully loaded content. \$\endgroup\$ – DMGregory Mar 13 at 11:43
1
\$\begingroup\$

You can use this to wait until something happens:

https://docs.unity3d.com/ScriptReference/WaitUntil.html

Or you can set up a load scene, where you load up and store stuff, than show it in the next scene when is is ready, or when the player presses a button:

https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadSceneAsync.html

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.