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

Resolved Get texture loading

Discussion in 'Project Tiny' started by QjOx, Jul 14, 2020.

  1. QjOx

    QjOx

    Joined:
    Oct 5, 2018
    Posts:
    10
    How get texture loading status from all images actually loading at start?

    upload_2020-7-14_11-23-31.png
     
  2. sebastianm_unity

    sebastianm_unity

    Unity Technologies

    Joined:
    May 3, 2018
    Posts:
    21
    Hi,

    you can look at all the Image2D components, they have a status field that will change while loading:

    Code (CSharp):
    1.    
    2. public enum ImageStatus
    3.     {
    4.         Invalid,
    5.         Loaded,
    6.         Loading,
    7.         LoadError
    8.     }
    9.  
    For example a system that does something like this in a system:
    Code (CSharp):
    1.    
    2.             int nPending = 0;
    3.             int nError = 0;
    4.             int nDone = 0;
    5.             Entities.ForEach((ref Image2D image) => {
    6.                 switch ( image.status ) {
    7.                     case ImageStatus.Loading: nPending++; break;
    8.                     case ImageStatus.Loaded: nDone++; break;
    9.                     case ImageStatus.LoadError: nError++; break;
    10.                 }
    11.             });
    12.  
     
  3. QjOx

    QjOx

    Joined:
    Oct 5, 2018
    Posts:
    10
    (probably is just me being dumb xd)
    but i already try it. I cant pick Image2D from Unity Tiny namespace
    upload_2020-7-16_18-13-12.png
     
  4. QjOx

    QjOx

    Joined:
    Oct 5, 2018
    Posts:
    10
    Yeap, it was just me being dumb, i forgot to add Unity.Tiny.Image2D to assembly file, i
    thought it was part of Unity.Tiny namespace.