Hello all. I'd like to preface this by saying that I know many similar questions have been asked about what I'm about to jump in to, but I can't find any answers to my particular problem.
While developing a Unity game using the 2D Toolkit, my team and I have run into a problem. At the start of the game, one may choose to be a male or female character. The default sprite library currently under use is the one for the male character, but we'd like to enable our female sprite animations.
We are writing a playerMovement script (all of our scripting is done in javascript) which is attached to the player object, and the playerMovement script will be doing the actual switching between male and female sprite collections. A script attached to the character selection scene changes a variable in the GLOBAL script in order to keep track of player gender for playerMovement. Currently, our implementation can succesfully change the GLOBAL variable to correspond to the male or female selections, and the character select scene works fine. The problem lies in the actual switching of sprite collections.
Once we have collected the GLOBAL variable, we need to change the Anim Lib of the tk2dAnimatedSprite component which is attached to the player gameobject. If I manually change the Anim Lib field in the tk2dAnimatedSprite from maleSpriteAnimations.prefab to femaleSpriteAnimations.prefab in the editor, the game runs with the female character just fine. However, we can simply not figure how to access the C Sharp fields and code that the 2D Toolkit uses from our javascript to make this run correctly. Moreover, we don't know exactly how to specify that it's a prefab that we're using from within code and to make sure the right file is being referenced.
Any help on this is greatly appreciated, I hope I've given enough detail. Thanks everyone.