Hello Guest

Author Topic: My Collection, what do I do to reload it?  (Read 4076 times)

Dajuice

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
My Collection, what do I do to reload it?
« on: August 07, 2013, 09:17:10 pm »
The textures now are unloaded, Great Job! :D

But I can't reload them :/

I have to unload textures from my UI, which are sprites that are directly in the scene, I manually delete in the editor the instance that uses the texture, unload the texture, then I put back another instance that uses the texture, the texture won't come back. Even worse, when I stop the test, the texture won't come back either, I need to save the project, then everything is reset to normal. Anything I could to to reload the texture?

Dajuice

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: My Collection, what do I do to reload it?
« Reply #1 on: August 07, 2013, 09:53:54 pm »
Nevermind,

public void ReloadTextures() {
      renderer.sharedMaterial.mainTexture = renderer.sharedMaterial.mainTexture as Texture2D;
   }

did the trick... it's working even easier than I ever dreamed of!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: My Collection, what do I do to reload it?
« Reply #2 on: August 07, 2013, 10:16:13 pm »
Thats a lovely one, really. Not sure if its a Unity bug or not, but sure looks like one. Thanks for reminding me that I should file a bug report when I get a chance.

Dajuice

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: My Collection, what do I do to reload it?
« Reply #3 on: August 08, 2013, 01:57:28 pm »
haha yeah that's strange, but in the meantime this "bug" makes life sooo much easier! I don't even have to destroy/change my sprite and it all works perfectly only with 2 calls!