• Runtimes
  • [Unity] Editor Integration Improvements

Related Discussions
...

Hi Mitch,

I'm having trouble to change the "Default Mix" of my SkeletonData during runtime.
What i'm trying to do is use a different "blend delay" between my animations depending on the situation. For example: If my character is walkng and it needs to fade to Jumping animation, than i want the blend to last for 2 seconds, but if character is falling and need to fade to Jumping animation, than i want the blend to last for 1 second.
The way i found to change this is changing the skeletonAnimation.skeletonDataAsset.defaultMix, i'm doing this just seting it's value, like: skeletonAnimation.skeletonDataAsset.defaultMix = 2.0f.

But doing this i'm experiencing a strange problem: sometimes, when i need it to change between animations, the fade happens instantly. And sometimes, when i want it to fade very quickly, it fade slowly. I'm also debugging the defaultMix's value to see if the value is right, and it is! So, it looks like Spine isn't using the defaultMix to determine the Mix Delay.

My question is, i'm doing the right approach changing the DeafultMix to control the "fade delay" between my animations? Or should I do it in a different way? And if i'm doing it right, than have you any clue about this bug that I mentioned?

I'm really confused here. lol

thanks

7 days later

If you set an animation twice it will make it appear that there is no mixing.

Ah hell I answered this but I think it got lost on my phone 🙁 I'll type up a better answer soon.

Hi,

I'm trying to make a build of a test project using Unity 4.6 beta. Just testing Unity 4.6 and Spine together and I'm getting an error with the runtimes that avoids the build:

Assets/Plugins/SpineUnity/Editor/AtlasAssetInspector.cs(31,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?

And the same for the following files:
BoneFollowerInspector.cs
SkeletonRendererInspector.cs
SkeletonDataAssetInspector.cs
SpineEditorUtilities.cs
SkeletonUtilityBoneInspector.cs
SkeletonUtilityInspector.cs

artblanc: why is the SpineUnity folder in the plugins folder? Thats a special folder for Unity.

Yes, you were right. Once it's outside plugins it creates the build.

Sorry for that.

artblanc wrote

Yes, you were right. Once it's outside plugins it creates the build.

Sorry for that.

No problem 🙂

Plugins (compiled 1st, DLL's placed here are copied to build directory - don't put editor stuff here)
Editor (compiled 2nd, not built during deployment)
Standard Assets (with the space) (built 3rd)
EverythingElse (built last)
StreamingAssets (without the space...) ( copied to Raw or StreamingAssets folder directly during build, ie: image.png will still be a PNG, not a Unity Texture - great place for keeping raw data)
Resources (everything here added to the Resources bundle at build time)

are all special folders in Unity, FYI.
Editor and Resources can be underneath another folder (ie: Assets/Spine/Resources/ )

12 days later

Just testing out the new unity integration and noticed that the auto generated hinge joints were not for the 2d engine. But from watching the video that was released months ago it looks like you intend 2d joints and rigidbodies to be generated?

The Box2D implementation in Unity 4.5 has some bugs that caused colliders to behave weirdly so Mitch decided against it.

Things might change in 4.6 or 5.
Maybe.

I tried attaching 2d rigidbodies and colliders manually to the hierarchy. After this I turned off the animation and hit play with override set for the Bone Utility Components.

I expected the attachments to fall with their respective colliders but for some reason they get detached and it looks like they are rendered relative to their parents or something like this.

Is there a way around this?

brockemon wrote

Just testing out the new unity integration and noticed that the auto generated hinge joints were not for the 2d engine. But from watching the video that was released months ago it looks like you intend 2d joints and rigidbodies to be generated?

The issue comes up with FlipX ... in order to match the Spine rig, skeleton utility must use Negative X Scale in the Unity hierarchy to make everything work - this effectively breaks all 2D and 3D physics colliders and even does even worse to the joints. The solution is to Rotate the character the other direction from the object that has the Spine anim applied to it, but this completely breaks 2D Joints ...... so I said nevermind and only left the 3D joints in. I'll probably make a video soon showing why all that is broken... sorry I don't have a better solution.

Also, it might be worth creating a runtime-only 2D (and 3D) ragdoll feature that specifically supports FlipX. The cost would be not being able to directly manipulate the transforms in the scene hierarchy since they wouldn't be able to be attached under the negative-scaled root.

a month later
Mitch wrote
brockemon wrote

Just testing out the new unity integration and noticed that the auto generated hinge joints were not for the 2d engine. But from watching the video that was released months ago it looks like you intend 2d joints and rigidbodies to be generated?

The issue comes up with FlipX ... in order to match the Spine rig, skeleton utility must use Negative X Scale in the Unity hierarchy to make everything work - this effectively breaks all 2D and 3D physics colliders and even does even worse to the joints. The solution is to Rotate the character the other direction from the object that has the Spine anim applied to it, but this completely breaks 2D Joints ...... so I said nevermind and only left the 3D joints in. I'll probably make a video soon showing why all that is broken... sorry I don't have a better solution.

Also, it might be worth creating a runtime-only 2D (and 3D) ragdoll feature that specifically supports FlipX. The cost would be not being able to directly manipulate the transforms in the scene hierarchy since they wouldn't be able to be attached under the negative-scaled root.

I've been away from Spine for a while due to other projects but ran into this while toying around this morning (beats Xmas TV).

My first thought was, maybe we could get around this by creating pre-flipped data - nicely exported with an "Include Flips" option in Spine, or a post-process script to generate the flip definitions. Now when FlipX is set and the FlipX data is found in our data, it plays the FlipX variants; no scaling or rotation required.

Any cons to this?

Happy holidays! 🙂

15 days later

Any updates on the 2D Ragdolls?
Really looking forward to having a solution for this.

At the moment I use Skeleton Utility to spawn a Hierarchy
I then create a Hinge Chain and on the rigid bodies for each bone I set the Constraint Properties to freeze Position in Z and freeze Rotation in X & Y.

Not sure if this is right, but it seemed to create an ok ragdoll to toggle on, but I cannot switch back to animated smoothly.

I would also like to be able to setup all the constraint limits and bounding box sizes in Spine, rather than Unity, is that possible?