2D Toolkit Forum
2D Toolkit => Support => Topic started by: vivaldi on October 03, 2013, 04:51:24 pm
-
Hello.
I have tk2dSprite object. How can I set sprite for this object from resources?
I need something like Resources.Load(file_name);
Thanks.
-
Create a prefab from it, put the prefab into a Resources folder. You can then be able to use Resources.Load (prefab name without extension ) to load it.
-
ok, looks like I asked nor very clear.
I have a few hundreds of .png files in Resources folder.
How can I load one of these files(depending of my game lvl) to the scene?
Thanks.
-
Load the texture in using resources.load, then use tk2dSprite.CreateFromTexture. Check the runtime sprite collection sample for an example of how to create a sprite once you've got a texture.