Hello Guest

Author Topic: When the Sprite Textures are Loaded?  (Read 4343 times)

wagenheimer

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
When the Sprite Textures are Loaded?
« on: April 11, 2014, 05:34:30 am »
I do have a sprite which I use as Background Texture.

But, I use the same scene for all my levels, and I change this Sprite Texture on my Custom Level Loading function which executes on the Start Method of the scene!

What did happens under the hood?

1) It loads the current sprite texture (already set on editor on design time), and after load the new texture I set for it? (Two Texture on Memory)
2) It will not load the default sprite texture, only the texture I set for it on Start function?

How to achieve the 2?

Thanks!


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: When the Sprite Textures are Loaded?
« Reply #1 on: April 11, 2014, 02:22:41 pm »
1 is what will happen.
To get 2 to happen you will need to load the texture using Resources.Load in OnEnable. You can try to get it to work in the editor as well, but it'll be considerably more complicated.