Author Topic: NGUI for the background image  (Read 7960 times)

kfboelter

  • Guest
NGUI for the background image
« on: August 22, 2013, 09:12:39 AM »
Hello everyone.

So.. I don't see much about using NGUI for background images, taht should cover the whole device screen.. something like a title screen.
How is that? What is the correct way? Should I use Resources.Load for that, in order to have it dynamically in and out of memory? Or should I use it just as a plain Texture on NGUI? What is best?

Regards

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI for the background image
« Reply #1 on: August 22, 2013, 09:50:03 AM »
You can have a UITexture with UIStretch on it set to cover the entire screen, Resources.Load its texture, unload it afterwards. Just note that when you unload, you need to first set the UITexture's texture to null, then wait until end of frame before unloading the resource.

kfboelter

  • Guest
Re: NGUI for the background image
« Reply #2 on: August 22, 2013, 10:32:58 AM »
Ah, it is kind of a mix, then :)

Awesome.

rur

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 5
    • View Profile
Re: NGUI for the background image
« Reply #3 on: September 18, 2013, 06:27:15 PM »
If you just destroy the game object that was loaded and attached to the Root by AddChild, will that free up the memory also?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: NGUI for the background image
« Reply #4 on: September 18, 2013, 09:57:23 PM »
Nope. But if you have all references to that removed, then you can call Resources.UnloadUnusedAssets() and it will be freed up. I think there's a direct UnloadAsset as well ( http://docs.unity3d.com/Documentation/ScriptReference/Resources.UnloadAsset.html ) but to be honest, I haven't tried it much so I dunno how that works.