Imagine the abuse!
Each time a unity logo is displayed a kitten dies. So use with caution
Imagine the abuse!
Each time a unity logo is displayed a kitten dies. So use with caution
Hi folks, I just bought Spine and so far it has been great! So congrats on the work so far!
I am using Spine with Unity and I am trying to find the best way to switch between animations. For example I have a shooting animation and when the shooting animation has been completed I want to return the character to either idle or running depending on its state upon completion of the shoot animation. I used to do this by adding animation events within Unity itself. Spine doesnt appear to have access to the animation panel within Unity just yet so what is the correct way for performing an action like how I am describing? I see that you can add events in Spine itself. Can these be used for what I describe? So I would add an event in Spine for when the shooting animation ends and then in Unity somewhere in my script I need to listen for that event? How is this done in C#?
I have seen this http://esotericsoftware.com/spine-events and I see code sample for adding a listener but I dont seem to be able to do the same thing within C# script. Can I see an example of how this is mean to be accomplished?
Thanks!
@glogic: You can definitely listen to OnAnimationComplete / End events from the Spine runtime, but you might be better off just using Mecanim if that's what you're used to: http://esotericsoftware.com/forum/viewtopic.php?f=7&t=4083
@[excluído]
You want to subscribe to yourSkeletonAnimation.state.Complete
If you don't know how C# delegates work and to subscribe in C#, look it up.
It basically looks like this:
yourSkeletonAnimation.state.Complete += YourHandleCompleteMethod;
It will pass parameters and stuff to your method that you'll find useful.
For more info on the difference between Complete
and End
, see the information linked below (eh?? Unity inside joke):
viewtopic.php?f=8&t=4050
Thanks @clandestine and @[excluído]
These are both the answers I was looking for. I now have it both working with mecanim and using the spine delegates Now I just need to decide which way I want to go with for future work.
Thanks for quick replies
It's worth mentioning that the SpineAnimation way with delegates is more predictable as there can be weird things that happen with keys during mecanim blending.
Mitch escreveuIt's worth mentioning that the SpineAnimation way with delegates is more predictable as there can be weird things that happen with keys during mecanim blending.
What kind of weird things? Strange blending of some kind, or inconsistent clarity on the "end" of an animation state?
[EDIT]
Nevermind I figured it out myself following this Unity forum thread -> http://forum.unity3d.com/threads/drawing-order-of-meshes-and-sprites.212006/
However if you have a better/simpler idea please let me know
Hello Mitch,
my name's Marco and I'm the founder and main programmer at Chestnut Games.
We are planning to buy Spine since it's an amazing piece of software and seems a great fit for our latest project, but we have one main concern regarding Spine and Unity 2D integration.
Do'not work Spine on Unity5 (5.0.0f4)
https://unity3d.com/jp/get-unity/download?ref=personal
http://netstorage.unity3d.com/unity/5b98b70ebeb9/UnityDownloadAssistant.dmg
I try this url
http://esotericsoftware.com/files/runtimes/unity/spine-unity.unitypackage
and
https://github.com/EsotericSoftware/spine-runtimes/archive/master.zip
import to
Spine Trial/examples/hero/export
renamed this files.
hero-mesh.atlas
hero_atlas.txt
hero-mesh.json
hero-mesh_json.txt
hero-mesh.png
hero.atlas
hero_atlas.txt
hero.json
hero_json.txt
hero.png
but
Do'not work Spine on Unity5 (5.0.0f4)
and I try this forum
http://ja.esotericsoftware.com/forum/search.php?keywords=Unity5
http://ja.esotericsoftware.com/forum/viewtopic.php?f=7&t=3713
but i can’t.
please help me.
hero.atlas.txt
hero-mesh.json
Hi Mitch,
I'm running Unity 5.0.0b18 and Spine 2.1.25 but when I import the runtimes from here http://esotericsoftware.com/files/runtimes/unity/spine-unity.unitypackage I get a whole bunch of errors when I try to run one of the example scenes Loading Image
Any ideas what I might be doing wrong please?
Thanks,
Mark
Is there any way to REMOVE an attachment in code? I prob missed something in the videos, but just curious if anyone knows off hand. Thanks!
MarkB escreveuHi Mitch,
I'm running Unity 5.0.0b18 and Spine 2.1.25 but when I import the runtimes from here http://esotericsoftware.com/files/runti ... itypackage I get a whole bunch of errors when I try to run one of the example scenesLoading Image
Any ideas what I might be doing wrong please?
Thanks,
Mark
Looks like they changed how they did script updates... latest github repo (not hte unity package) shouldn't need to be API-updated for Unity 5. try doing a clean pull. I'll try and address this with a few other Unity 5 issues sometime today.
Hey Mitch,
Just wanted to say thanks for the tutorials. I just made a switch to unity from monogame and your tutorials and implementations are making my life so much easier.
Kevin
Hi, is there still a bug in the latest version of Spine? Because when I export my project it doesn't make a prefab or anything automatically which I really wouldn't mind but after setting everything up my character has white boxes around it and the art is a faint black on the inside, I tried playing with texture setting and atlas export setting but nothings worked so far...
Hi, I am having some difficulty with Spine and Unity when using slots. I followed your video and was able to attach weapons to a slot no problem. When I run it within Unity everything is great I can see the weapons correctly attached to the slot I provided. Then when I create a build for other people to try out the weapons are missing. They seem to appear for 1 frame when I add them but then disappear immediately. This happens for both windows and mac builds.
Here is an example of code I am using for adding to the slot
skeletonAnimation.state.SetAnimation(0,"Idle",false);
skeletonRenderer.skeleton.AttachUnitySprite("blank_weapon",weaponSprite) ;
so I am attaching the weapon right after starting the idle animation.
Works fine when run in Unity
Any ideas what I am missing here? I just seen in an above post that I should use the scripts in the repo and not the spine package provided. Is this still the case? Ill try this when I get home from work. If anyone has any other ideas about what could be the issue here I am all ears!
Thanks
G
Edit: Ok I tried using the repo instead of the package but the issues remain when I make a build. I am using unity 5 if that matters?
Works fine for me.
Do you have any Attachment Keys in your animation for Idle that are effecting the blank_weapon slot?
Are you calling "SetToSetupPose" or assigning a skin anywhere?
PS:
Generally the unity package is kept up to date with the repo, but it might take a day or so before I get around to repacking it.
Hi Mitch,
Yes I am calling SetToSetupPose at the start of all animations like this
void StartAnimation(Spine.AnimationState currentState, int i){
skeletonAnimation.skeleton.SetToSetupPose ();
}
I have tried removing this and also just calling it before the idle animation is called.
I will have to talk to the artist about the attachment keys and see if there is anything effecting the slot. Is there a reason why this would work when run from Unity IDE but not from a build?
I also updated to Unity 5.0.1 in the last 30 mins to see if that helped but no joy.
Can you send me your exported Spine data? Preferably everything included, but I only really need the .json and the .atlas.txt if something is super secret.
(PM me a private link or some such)
Received.
Still works fine on my end. Sending you a packaged project (import into a blank Unity 5 project)
Just want to say for the record that Mitch is a legend and was able to fix the issue even with a face full of burrito!
Just in case anyone comes across this same issue I had to set the sprite material of the weapon to match the sprite that contained the weapon slot. I was using Spine/Skeleton lit
skeletonRenderer.skeleton.AttachUnitySprite("blank_weapon",.weaponSprite,"Spine/Skeleton Lit") ;
thanks again
G