Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Strange error message: mipLevel < m_MipCount

Discussion in 'General Graphics' started by JoergLange, Nov 19, 2016.

  1. JoergLange

    JoergLange

    Joined:
    Oct 22, 2015
    Posts:
    21
    I load some textures at runtime, which works perfectly fine, including mipmaps:

    photoTexture = new Texture2D (2, 2, TextureFormat.DXT5, true);

    However this causes a strange "error message" in the editor (console):

    ! mipLevel < m_MipCount

    This error has no effect, I'm able to build the project, but it's a bad feeling, seeing this always at the console.

    Has anyone an idea how to get rid of those message?

    Best regards
    Jörg
     
  2. mikaelwallen

    mikaelwallen

    Joined:
    Jun 3, 2016
    Posts:
    56
    I also just ran into this when doing:
    m_texture = new Texture2D(
    1,
    1,
    TextureFormat.DXT1,
    true);

    m_loader.LoadImageIntoTexture(m_texture);

    As you can see the texture is just created to be able to fill in the data from a WWW object.
     
  3. JoergLange

    JoergLange

    Joined:
    Oct 22, 2015
    Posts:
    21
    If you use a different texture format (RGB24 I believe) it works fine, without the error msg.

    But I have to use DXT5 and even if the problem is some kind of a non-event (because the program still runs fine), the red error msg are a bit annoying, feels not good.

    So it seems there is no workaround for that?
     
  4. JoergLange

    JoergLange

    Joined:
    Oct 22, 2015
    Posts:
    21
    Since I upgraded to 5.5 yesterday the "error" has changed to:

    Assertion failed on expression: 'mipLevel < m_MipCount'

    However, its the same strange thing. Everything runs fine, but this bloody messages in the editor during runtime driving me nuts... grrrr
     
  5. the-small-Hippopotamus-amphibius

    the-small-Hippopotamus-amphibius

    Joined:
    Nov 26, 2019
    Posts:
    1
    new Texture2D(int width,int height,TextureFormat textureFormat,bool mipChain,bool linear)
    Make sure the legth and width are not zero.
     
  6. cholleme

    cholleme

    Unity Technologies

    Joined:
    Apr 23, 2019
    Posts:
    27
    This is caused by the fact that DXT5 textures should at least be one DXT block in size (4x4 pixels) so creating a 2x2 or 1x1 DXT texture is invalid. We noticed this issue previously and it should be fixed (by giving a clearer error) in 2021.
     
    Siccity and unity_O7EbXnl7l5GFDg like this.
  7. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    Anyone else who's still using 2020, this seems to happen when images aren't power-of-two sized.