- Uređeno
Multiple spine projects for animation 1 character to Unity
Hello, I'm just looking for a bit of advice \ guidance on the method an workflow for something like this:
I'm working on a small test project, might be considered something of a Zelda clone. So the game camrea has a top down view, with a character that I've animated walking up (away from camera, so you see his rear), left and right and down (faces towards the camera.)
I've gone and made 4 spine projects, 1 for each direction of movement (up, down, left and right). Now my question is, is this the correct\efficient way to go about this? (It seemed logical since the artwork for walking north, so you see the characters rear, is different to the artwork for when he walks down or left or right).
When I want to export this animation data from Spine to Unity for implementation in the game, I'm importing 4 projects for 4 separate animations. Does this make sense?
Alternatively, I assume it would be possible to import all image data into 1 spine project for all directions of animation? Is this a better way to go about it? (1 massive spritesheet at the end of the day containing image slices of rear, front and side views?).
Now, if thats the better option, to have 1 project with ALL animations for ALL directions and artwork, is it possible I can combine my 4 spine projects into 1 or do I need to re-animate everything from scratch and start a new project?
Any and all advice is welcome! Thanks for this amazing software
Cheers
- Uređeno
This is something I would really love Spine to be able to eventually do someday: Have multiple bone hierarchies and switching between them within an animation, within one skeleton (at least without the associated cost of having twice or thrice the number of bones being updated or having a bunch of extra timelines keeping slots enabled or disabled per switch to a different hierarchy)
Sadly, this isn't ideal or efficient right now, workflow-wise and performance-wise, even if it is possible and even playable given enough CPU power.
And for anyone else reading and knowing that this isn't as big an issue and I think, let me know.
Here's how it works now, assuming this is a Zelda-like game:
(1) The artwork/images don't need to be separated. You can put them in different subfolders, but they can all be in one atlas, SHARED by three or four or as many skeletons as you need. So if you ever need to use one image across all skeletons, it's not a problem at all.
(2) A Spine project can have multiple skeletons. This means you have one .spine file and can see them and animate them in each others' context. If you already started working on different skeletons in different .spine files, you can use the Import Project
option under the Spine menu
to bring the different skeletons into one .spine file.
Given (1) and (2), you can expect one .atlas.txt, one.png, and several .jsons going into Unity.
(3) This will take more thoughtful programming than if it were a sidescroller. What you'll need after this is an intervening class that knows what state your character is in and handles which skeleton to show or hide and play animations from when you, for instance, press right, or press up, or attack.
(4) Sadly, since the three or four directions will be segregated into their own skeletons, this will make it very weird to make animations that make your character spin around these directions (as Link usually does with special attacks).
PS
This is also assuming you're actually using bones to animate these things. If you were just using frame-by-frame animations, this isn't an issue at all.
Like Pharan mentions you can have multiple skeletons in the same project. You can import one project into another you just need to use different skeleton names. You can either import a JSON file with Import Project
or you can import a .spine file with Import Data
Pick whatever suits you the best. Just keep in mind that if you import a JSON file, you probably want to export the JSON with Nonessential data
checked.
Thanks very much for the responses!
I've created a root skeleton, that contains more "root" skeletons for each animated direction of movement.
What would be the best way programmatically to hide the entire other 3 skeletons and leave 1 remaining for the direction the player is moving in? (Pretty much like how you suggested)
In unity I can see SkeletonAnimation has .skeleton.FindBone() method, is there an easy way to find and hide my "root" skeletons for the directions that I don't want to display for a particular direction?
Again thanks so much for the valuable assistance!
Cheers
I haven't tried this myself. I think you'll have to have a go at it with trial and error, assuming you know enough how to program.
Hello ,
I've managed to keep all 4 skeletons in spine and animated accordingly, but now I'm hiding all other images from within spine (keyed visibility off for skeletons that aren't needed) at the start of every animation. So basically I only display 1 skeleton during an animation for a given direction.
This seemed to solve all issues however, now when the animations are brought into unity (1 json, 1png, 1 atlas) all animations are there and appear correct, but switching between animations causes the material to fall off from the animation\game object?
We're fixing with skeleton.SetToSetupPose(); but it seems very hacky. Is there a better way to do this? Can someone give us an example of how we're supposed to do this? (There's a lack of documentation for this kind of thing since its all custom Spine code\runtime that we're dealing with here.)
Thanks for any and all assistance and advice!
Amazing product, I'm loving animating with Spine.
This one is beyond me I'm afraid, hopefully someone else will be able to give you some ideas.
Happy to hear you're loving Spine though! Thanks!
Shiu wroteThis one is beyond me I'm afraid, hopefully someone else will be able to give you some ideas.
Happy to hear you're loving Spine though!
Thanks!
Hi any Esoteric Developer able to shed any further light on this?
Thanks!
Have you considered using multiple skeletons in the same project ?
As I said earlier, I am using multiple skeletons, the problem is that when changing between animations which are on different skeletons, the material suddenly disappears (We cannot ascertain a feasible reason for this? no explanation it just falls away completely) which results in the animation disappearing. We have managed to fix this by calling skeleton.SetToSetupPose() when changing to an animation that uses a skeleton different to the current skeleton, but we are unsure if this is the correct approach due to there being no examples or documentation on how to do this.
As a new user, the severe lack of documentation has made using spine a lot more painful than it ought to be for such a great piece of software.
Thanks for any insight!
It could be caused by not setting keys for the slots at the first frame of your animations. Without seeing the project itself it's hard for me to say. skeleton.SetToSetupPose()
is a valid way of doing it though. All it does is reset your slots to how they look in Setup mode.