2D Toolkit Forum

2D Toolkit => Support => Topic started by: wagenheimer on April 11, 2014, 05:34:30 am

Title: When the Sprite Textures are Loaded?
Post by: wagenheimer 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!

Title: Re: When the Sprite Textures are Loaded?
Post by: unikronsoftware 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.