Author Topic: how to create a new plane with the same texture as 'Sprite' created from NGUI  (Read 5220 times)

Spacez

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
hi, i want to create a new plane (using code) with the same texture as the 'Sprite' widget created using NGUI.
I worked with it for some time and what i can get is a whole atlas texture (i use getcomponent<UISprite>().mainTexture ) but cant get the exact texture i really want in the atlas.

is there any ways to do this ?

Thanks for every help :)


-------------------------------------

Another question, how can i use the texture in the atlas for my current 'prefab' ( in my prefab i have texture set for the object but i dont know how to replace the texture with the one in the atlas)

thanks
« Last Edit: September 06, 2013, 11:10:28 AM by Spacez »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
If you need the image tiled: no.

Sprites are just parts of a texture. You could set up a material that draws only that part of a texture, but it will need to be adjusted every time you update the atlas.

Use a UISprite for this. Not sure why you bother creating a plane. A sprite is a plane as well.

fur

  • Guest
So, it's cant be done?
Coz what I want is also the Texture of the sprite only, so I can save to file / post online the texture, from what user done in game...