Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Wasm Loader for Tiny Game

Discussion in 'Project Tiny' started by Fotal, Dec 8, 2020.

  1. Fotal


    Apr 9, 2019
    Hi, I wrote on this topic on various threads, here I want to summarize all the questions regarding loading the game because this is an important part of making a game product ready for promotion for us at this moment.

    The Problem is:
    1. Slow Internet. If you live in places/countries that do not have stable mobile 4g, or even 3g, the following points are for you...
    P.s. most people play your game from mobile phones using a mobile internet connection.

    2. No loading just a white square. The game on Unity Tiny is not so tiny, it can reach a size of 10 - 20 MB, which is quite a lot and you need to give the player at least some feedback, not just a white screen ( This mainly happens if you are using an unstable mobile Internet,

    3. Loaded, but not everything. The game does not load completely, let's look at the same example ( your textures may not load and they will be white, your UI may not load, it will either be absent, or everything will also be filled with white squares.

    Possible Solution
    A) That's what we need, let's look -
    1 - 2 Facebook gives us feedback about game loading status
    3. The game is fully loaded.

    Solution A) works great on Facebook, but what if you want to publish the game on your own domain? Oops (

    B) Wasm Loader like a Unity WebGL game loading
    We would like to know if there will be any solution and how soon?

    С) Wasm Loader like a Facebook loader.
    We would appreciate any help or direction in which we could move to make the game load the same as Facebook: server setup, etc. things.

    To Summarize:
    We have already made one game on Unity Tiny -, but its problems are exactly the same as described above. Loading with a percentage at the start is just a simulation, to win a few seconds, then a white screen comes.

    At the moment we are in the process of developing a second game and are very concerned that we do not have a solution to loading the game correctly as written in one of the possible solutions.

    We would be very grateful for any help in solving this problems.
    Zenithin and newguy123 like this.
  2. AbdulAlgharbi


    Unity Technologies

    Jul 27, 2018
    We understand the issue, and I agree tiny needs a scene loading progress api
    but you still can create the following system
    Code (CSharp):
    3. using Unity.Entities;
    4. using Unity.Tiny;
    6. namespace TinyRacing.Systems
    7. {
    8.     [AlwaysUpdateSystem]
    9.     public class Loader:SystemBase
    10.     {
    11.         public bool IsReady;
    13.         protected override void OnStartRunning()
    14.         {
    15.             base.OnStartRunning();
    16.             IsReady = false;
    17.         }
    19.         protected override void OnUpdate()
    20.         {
    21.             if (IsReady)
    22.                 return;
    23.             Debug.Log("Loading...");
    24.             var loading = false;
    25.             Entities.WithAll<Image2DLoadFromFile>().ForEach((Entity e, ref Image2D img) =>
    26.             {
    27.                 if (img.status == ImageStatus.LoadError)
    28.                     Debug.Log("Error loading images");
    29.                 loading = true;
    30.             }).WithStructuralChanges().Run();
    31.             IsReady = !loading;
    33.             if (IsReady)
    34.                 Debug.Log("Ready!");
    35.         }
    36.     }
    37. }
    which will wait for all the images/ textures to load and you can sync your game so it starts when all textures are loaded
    Seaqqull and Fotal like this.
  3. Fotal


    Apr 9, 2019
    Thanks a lot. It's very helpful for us)
  4. Fotal


    Apr 9, 2019
    Can we prioritize the loading of images using the method above? For example:
    1. At first load in-game loading screen images assets.
    2. Wait for all the images/ textures to load
  5. AbdulAlgharbi


    Unity Technologies

    Jul 27, 2018
    Yes, You can make a loading screen that is auto loaded when the game starts.
    Then have the game as a subscene that loads afterward, In Tiny we only load textures once the scene is loaded
    after that when everything is loaded navigate to your game subscene
    Fotal likes this.
  6. todans


    Mar 4, 2014
    It's not mentioned, but you will need to include Unity.Tiny.Image2D assembly reference in your main asmdef to make it work. Also it would be great to see an example of scene loading. Thanks.