Search Unity

"Invalid texture used for cursor - check importer settings" warning spam since Unity 5.4 update

Discussion in 'General Graphics' started by Reign_of_Light, Oct 6, 2016.

  1. Reign_of_Light

    Reign_of_Light

    Joined:
    Oct 15, 2014
    Posts:
    46
    Hi everybody,

    since the Unity 5.4 update my console is being spammed with an endless stream of the warning "Invalid texture used for cursor - check importer settings".

    Yes, I've got a custom cursor, and it's changing every now and then using the UnityEngine.Cursor.SetCursor() method. It still works great, if it wasn't for the warnings spamming my console.

    The importer settings of the Cursor-images are the same I use for many other sprites that render well and do not throw warnings:

    TextureType: Sprite (2D & UI)
    SpriteMode: Single
    PackingTag:
    Pixels per Unit: 100
    Pivot: Center
    Generate Mip Maps: no
    FilterMode: Bilinear

    Currently no platform-dependent overrides.

    Also, the images are 64x64px, so they are square and divisible by 2 as well as by 4. Not that it would/should be required, but still..

    Does anybody have an idea as to why these warnings happen? Is it a bug or what could be wrong with my cursor textures?
     
    Last edited: Oct 6, 2016
  2. BMacZero

    BMacZero

    Joined:
    May 31, 2015
    Posts:
    1
    Obviously this is a very late reply, but these are the import settings that are checked to generate this error:
    • Format is ARGB32
    • The texture is readable
    • alphaIsTransparency is true
    • The texture is not mipmapped
    If you're generating textures at runtime, you would have to set "alphaIsTransparency" to true after constructing the texture, but because of this bug, you'll need to wrap that in an #if UNITY_EDITOR block. This is fine because the warning does not appear in the standalone.
     
    Last edited: Nov 18, 2016
    stevekrile, xucian, Gecovin and 4 others like this.
  3. ArchVen

    ArchVen

    Joined:
    Nov 24, 2016
    Posts:
    1
    Just set Texture Type to CURSOR
     
  4. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    Got it:
    after you set it as Cursor, you have to check "Read/Write Enabled" in Advanced.
     
  5. aibolith

    aibolith

    Joined:
    Apr 9, 2017
    Posts:
    9
    You, sir, was very helpful! How am I supposed to know that after setting a cursor texture type to "Cursor" it wouldn't work as a cursor unless I changed a parameter in advanced without you?
     
  6. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    Indeed I was wondering too until I've discover it :D
     
  7. UnitySwift7

    UnitySwift7

    Joined:
    Nov 17, 2016
    Posts:
    1
    Hi,
    Where I find this option?

    Regards
     
  8. FalsAlarm

    FalsAlarm

    Joined:
    Dec 12, 2016
    Posts:
    21
    I would also like to know where to find Advanced? so that I can checkmark 'Read/Write Enabled'. please and thanks
     
  9. SiSShadowman

    SiSShadowman

    Joined:
    Apr 7, 2015
    Posts:
    1
    I just stumbled upon this very same problem so I thought to give you a screenshot:
     

    Attached Files:

    thetimharms likes this.
  10. furmuspala

    furmuspala

    Joined:
    Jan 27, 2018
    Posts:
    2
    How I can open this page, where?
     
  11. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Select the texture in the assets.
     
  12. furmuspala

    furmuspala

    Joined:
    Jan 27, 2018
    Posts:
    2
    Thank you so much
     
  13. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    No problem :)
     
  14. Pan_Dziobak

    Pan_Dziobak

    Joined:
    Mar 4, 2016
    Posts:
    1
    I know this is very old topic but since it's the most relevant one found and my problem has exactly same basis, I decide to write here anyway.

    1. I get "Invalid texture used for cursor - check importer settings" warning (same as author)
    2. Cursor is animated by looping through sprites...
    3. ... and these sprites all originate from same texture (see included image)
    4. Problem is that setting Texture Type to CURSOR forbids from using sprite editor to slice texture.

    So what do I do? Any alternative to slicing all cursor images into even more cursor images?
     

    Attached Files:

    RiftyM likes this.
  15. RiftyM

    RiftyM

    Joined:
    Mar 6, 2018
    Posts:
    1
    Hey Pan (and anyone in the future reading this), I found these settings fixed the issue, you might want to start with them and see if you can't use a cursor texture, then at least you're heading in the right direction to get the issue fixed:

    upload_2018-7-8_23-1-12.png

    Make sure the settings are exactly as you see them here, it should resolve the error!
     
    dohaaaaaa, Skyolk and ZadiusC like this.
  16. Pablomon

    Pablomon

    Joined:
    Mar 9, 2015
    Posts:
    47
    I guess the option is to create a texture programatically from the sprite's rect texture and set it as cursor. Somebody who has done it?
     
  17. dmitriyreznikov

    dmitriyreznikov

    Joined:
    Feb 19, 2017
    Posts:
    1
    I just had to reimport cursor.
     
    altschuler likes this.
  18. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
    Late reply, but I just did:
    Code (CSharp):
    1.     static private Texture2D MakeTexture2DFromSprite( Sprite sprite )
    2.    {
    3.        Texture2D texture2D = new Texture2D( (int) sprite.rect.width, (int) sprite.rect.height, TextureFormat.RGBA32, false );
    4.  
    5. #if UNITY_EDITOR
    6.        texture2D.alphaIsTransparency = true;
    7. #endif
    8.        var pixels = sprite.texture.GetPixels( (int) sprite.textureRect.x,(int) sprite.textureRect.y, (int) sprite.textureRect.width, (int) sprite.textureRect.height );
    9.        texture2D.SetPixels( pixels );
    10.        texture2D.Apply();
    11.  
    12.        return texture2D;
    13.    }
    14.  
    15.    static private Vector2 GetHotspotFromSprite( Sprite sprite  )
    16.    {
    17.        return sprite.pivot;
    18.    }
    Generate these once from all my sprites at start time, and set them dynamically using:

    Code (CSharp):
    1. Cursor.SetCursor( texture, hotspot, UnityEngine.CursorMode.Auto );
     
  19. warrenbrandt

    warrenbrandt

    Joined:
    Mar 3, 2018
    Posts:
    413
    that did it for me, tanks
     
  20. MitchAlenPek123

    MitchAlenPek123

    Joined:
    Mar 25, 2020
    Posts:
    1
    Damn ur helpful

    Right away, I wanted to use one of the ink resource images, and you made it 100% easier

    thanks again!
     
  21. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,363
    That's it! Thanks buddy!
     
    Jaggard likes this.
  22. ZadiusC

    ZadiusC

    Joined:
    Apr 24, 2020
    Posts:
    3
    Thank you for the screen shot! Solved it for me right away.
     
  23. TheHemohscinProject

    TheHemohscinProject

    Joined:
    Jun 5, 2020
    Posts:
    3
    aaaaaaaaaand where are these checks?? unity seemingly is hiding all of them from me
     
  24. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    This is the standard texture import window, what comes up in the inspector when you select a texture.
     
  25. jakubwbierowka

    jakubwbierowka

    Joined:
    Sep 12, 2022
    Posts:
    1
    Worked for me! Ty ;3
     
  26. catafest

    catafest

    Joined:
    May 3, 2014
    Posts:
    78
    If you use the version Unity 2021.3.12f1 then you need to have this settings :
    upload_2022-11-13_17-28-32.png
     
  27. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    I'll move this post to the General Graphics sub-forum.
     
  28. unity_zP4G898ky1jT3A

    unity_zP4G898ky1jT3A

    Joined:
    Mar 11, 2023
    Posts:
    26
    THANK YOU ! TEŞEKKÜRLER ÇÖZÜLDÜ. İmleç fotoğrafına tıkladıktan sonra inspector menusunden Texture Type seçeneğini Cursor olarak ayarlamanız yeterli. Uyarı kalkıyor.