Search Unity

PNG icon distortion

Discussion in 'Editor & General Support' started by Sancho_Panzer, May 20, 2020.

  1. Sancho_Panzer

    Sancho_Panzer

    Joined:
    Apr 20, 2020
    Posts:
    6
    I obtained a collection of png icons from the asset store. I was planning to use these icon to replace the cursor depending on in-game actions.
    Code (CSharp):
    1. public Texture2D pointer;
    2.     public Texture2D target;
    3.     public Texture2D doorway;
    4.  
    5. //some logic
    6. Cursor.SetCursor(target, new Vector2(16, 16), CursorMode.Auto);
    7.  
    8. //some logic
    9. Cursor.SetCursor(doorway, new Vector2(16, 16), CursorMode.Auto);
    10.  
    11. //some logic
    12. Cursor.SetCursor(pointer, Vector2.zero, CursorMode.Auto);
    13.  
    Despite lacking syntax errors, this piece of code causes to unity to display the png icons with certain level of distortion.
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,909
    In the import settings for your cursors:

    Are you using the "Cursor" Texture Type?
    What Filter Mode are you using? You should generally use Point filtering for a cursor.
    You should probably also use High Quality or no compression as well.