Unity Tips and Tricks: Playing a Spine2D Track Entry at Modified Speed

I came across this article showing how to play a trackentry on a Spine2D game object within Unity.

Spine2D is a software package made by a company called Esoteric Software which we are using to create our newest game.

The code below can be used to change your Character’s animation speed during runtime.

SetAnimation(0, “animation”, true).timeScale = 0.5f;

This link leads to the topic thread on the Spine2D website.

Git Error: Another Process Seems to be Running

I exited out of the Git terminal after pressing a command by accident. This caused an interesting error message to appear.

The way out of this is answered in this stack overflow page

My “git add .” command succeeded after navigating to the directory and removing the file in the manner suggested above.

Making Unity Prefab Creation a Habit

I often find myself during development slipping back into bad practices and having to beat good ones into my head.

A good habit for game development in Unity is making prefabs. Prefabs ensure that you are following the principle of DRY.

In the case of game objects, this includes everything from Characters, Enemies, Platforms, Weapons, Scripts and anything you will have to use more than once (which in Game Development is a lot of things).

Prefabs are useful, and I am trying to force myself into writing reusable code.

Here is a short tutorial on YouTube showing How to create Prefabs in Unity.

I am also keeping a list of the tutorials I am using throughout my project on YouTube.

11-6-2019: Spine Mixing Causes Event Dropping

Skeleton Animation objects in Unity by default blend animations together that you have queued on the same track by starting the next animation before the first one is finished.

This was causing the OnEvent triggers we set up in our Spine files (such as “JumpStart”, “AttackEnd”, “Interrupt”) to be ignored at runtime.

Since we mix our animations together on the drawing side, the fix for our case was setting the default mix to 0 for each Spine Asset we are bringing into the game that has events.

There is more information about about handling Spine Events with mixing on the Spine Website.

If you wanted to keep the mixing behavior that Spine provides by default (where animations are blended together with code rather than with drawing), you have to adjust the Event Threshold within a C# script to allow for event reading with one of the settings described below (note: taken from Spine Documentation).

Spine2D User Events During MIxing

A TrackEntry’s EventThreshold controls how user events are treated during the mix duration.

  • With the default value 0, user events stop being raised immediately when the next animation starts playing.
  • If you set it to 0.5, user events stop being raised halfway through the crossfade/mix.
  • If you set it to 1, events will continue to be raised up until the very last frame of the crossfade/mix.