Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Custom Cursor (Sprite) goes behind GUI elements

Discussion in 'Immediate Mode GUI (IMGUI)' started by nmtri9999, Jul 17, 2014.

  1. nmtri9999

    nmtri9999

    Joined:
    May 8, 2014
    Posts:
    4
    Hi everyone ! Im a newbie here.

    Thing is, I created an animated cursor (sprite with animator attached), everything works just fine but my cursor keep going behind GUI buttons (as GUI elements are drawn last) !?!!?

    I've already tried using GUI.depth without luck, setting up another camera and culling mask didn't help neither !!!

    Did much research but found nothing, Im stuck here now ! Please help me :( !!!

    Sorry about my English and thanks in advance !!!
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    You can make the custom cursor using GUI.DrawTexture instead of sprites, or use a hardware cursor.

    --Eric
     
  3. nmtri9999

    nmtri9999

    Joined:
    May 8, 2014
    Posts:
    4
    Tks Eric but the fact is i want my cursor to be "animated", can you please show me how to draw a sprite sheet with
    GUI.DrawTexture ? I did search for it but there seems to be no detail infos.

    Tks again :D !!!
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    You can use an array of textures.

    --Eric
     
  5. nmtri9999

    nmtri9999

    Joined:
    May 8, 2014
    Posts:
    4
    Working on it by now ! Tks again ! I really appreciate that :D !!!
     
  6. nmtri9999

    nmtri9999

    Joined:
    May 8, 2014
    Posts:
    4
    Tks for all those replies Eric !!! I know u'r busy with ur work but would u plz help me one more time ??

    U said i should use an array of texture yes ?

    But now my texture is from a sprite sheet and i cant use a sprite frame as texture (Unity wont let me).

    Is there any "easy" way to achieve that instead of writing a script to convert them ?

    And after all these GUI will be hidden by ModalWindow but i'll figure a way to fix that later :D !