Author Topic: Atlas sprites for cursor pointer  (Read 2887 times)

Tatanan

  • Jr. Member
  • **
  • Thank You
  • -Given: 11
  • -Receive: 0
  • Posts: 81
    • View Profile
    • Casual Arena
Atlas sprites for cursor pointer
« on: November 10, 2014, 05:42:33 AM »
Usually, for having a custom cursor pointer in Web Player, Unity offers you the class Cursor as follows:
Quote
private Texture2D cursorTexture;
cursorTexture = MyResources.Load<Texture2D>("handCursor");
Cursor.SetCursor(cursorTexture, cursorPosition, CursorMode.Auto);
I need to have a texture in a Resources folder.
I'd like to create that Texture2D from a NGUI Atlas. Is it possible? May I create a Texture2D from an Atlas?

I know NGUI has something to handle cursor, but as far as I know, it's not really a cursos but a sprite following the pointer, which it's not exactly what I need (unless I'm wrong).

Thank you.
Game developer on Casual Arena.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas sprites for cursor pointer
« Reply #1 on: November 10, 2014, 08:59:02 PM »
NGUI atlas is a collection of textures. It's not a good idea to place your cursor in an atlas as Unity won't take advantage of it. Keep it a separate texture.