Author Topic: Using sprite from atlas for spriteRenderer  (Read 13348 times)

Lautaro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 44
    • View Profile
Using sprite from atlas for spriteRenderer
« on: February 13, 2014, 07:46:30 AM »
The NGUI sprite atlas i use for the gui has a sprite i need for the game world. Can i use it with a normal unity SpriteRenderar through code? How?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Using sprite from atlas for spriteRenderer
« Reply #1 on: February 14, 2014, 05:56:44 AM »
SpriteRenderer is Unity2D, and is a completely different system. You won't be able to use it. NGUI can draw 2D sprites (UI2DSprite), but 2D sprites can't draw NGUI sprites.

Lautaro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 44
    • View Profile
Re: Using sprite from atlas for spriteRenderer
« Reply #2 on: February 14, 2014, 12:28:08 PM »
I thought so, since Unity2D is a newer function right? So then i will make NGUI Atlases for the gui and go the other way for the in screen sprites. :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Using sprite from atlas for spriteRenderer
« Reply #3 on: February 15, 2014, 01:07:37 AM »
Unity 2D stuff is a part of Unity, and knows nothing about NGUI. NGUI is a plugin, it wouldn't make sense for the core tech to know something about plugins.

Lautaro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 44
    • View Profile
Re: Using sprite from atlas for spriteRenderer
« Reply #4 on: February 15, 2014, 01:36:47 PM »
Ofcourse. I was more thinking in the line of NGUI yet not adapted to Unity2D.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Using sprite from atlas for spriteRenderer
« Reply #5 on: February 16, 2014, 02:13:16 AM »
It will be once Unity 4.5 (or 4.6?) comes out, because that's when the missing script functionality gets added. Right now 2D is incomplete and has no way of retrieving some important information on the scripting side. 2D in 4.3 was not meant to be scriptable.