2D Toolkit Forum
2D Toolkit => Support => Topic started by: drkucho on January 09, 2014, 04:14:46 pm
-
I'm trying to do this, as per the script documentation.
tk2dBaseSprite.SetSprite (tk2dSpriteCollectionData newCollection, int newSpriteId )
but i get Assets/Scripts/Player.js(384,56): BCE0005: Unknown identifier: 'KuchoShirtCollection'.
KuchoShirtCollection is the name of my sprite collection just like i have it on the project folder , yes i name my sprite collections ending on "collection" to avoid confusions
the question is how to get the tk2dSpriteCollectionData from code? javascript if possible, thanks
-
Hello?
-
As you can see in the script documentation you posted, you need a tk2dSpriteCollecitonData object as the first parameter. You can't just type the name of the object, you will need to load it somehow. One way to do that in Unity is using a public variable, i.e. create a public variable with the type and drag the collection into the slot in the inspector. Another way is to use Resources.Load (http://docs.unity3d.com/Documentation/ScriptReference/Resources.Load.html).
-
thanks a million , the drag and drop way is not very convenient for my case, ill check the load resources thing