Keying and easing techniques - Spine Tips #6

November 1st, 2023

We are happy to share a new Spine Tips tutorial video! You probably have already heard of “ease in” or “ease out”, but are you sure you know what they mean? In this video we'll show exactly what they are and how they can help you to make better animation.

Various workflows require different keying techniques. Here we cover a few approaches to setting keys and show how you can leverage them for your own work. Also, see how using the many tools in Spine can get you faster and better results!

Whether you are new to Spine or looking to improve your skills, you should find some valuable tips here. Stop by the Spine forum and discuss your own keyframe techniques for a better workflow!

Have fun and happy animating!

Exploring spine-ue4

October 16th, 2023

Let's explore using Spine with Unreal Engine! Learn how to use the basic components of the spine-ue4 runtime with blueprints or C++ code.

This video builds on our previous video by showing how to setup and use the spine-ue4 components. If you want to know how to install the spine-ue4 runtime, please watch the previous video: Getting Started with spine-ue4

Did you find this video useful? Join the discussion of this post on the Spine forum!

Setting up spine-godot with C#

October 2nd, 2023

This blog post briefly explains the steps to get started using C# with spine-godot and how it differs from using GDScript.


Installation

You can download our pre-built Godot 4.1 editor and export template binaries with C# support from the spine-godot runtime documentation. Follow the documentation there for basic installation instructions.


C# project setup

To use our Godot editor binaries with C# support, you need to take an extra step when setting up a new Godot project:

1. Create a Godot project

First, create a new Godot project using the downloaded Godot editor binary that has C# support.

Failed to load .NET runtime

If the Godot editor fails to load the .NET runtime, the following error message will appear at startup:

As described in the message, please install the .NET SDK 6.0 or later from Microsoft's official download site and restart Godot.


2. Create a godot-nuget folder

Close Godot and open your project folder. In the root directory, create a new folder called godot-nuget.


3. Copy the C# assemblies

Copy the Godot C# assemblies into the godot-nuget folder. If you are using Windows or Linux, you can find the assemblies in the downloaded Godot editor ZIP file:

  • Windows: godot-editor-windows-mono.zip\GodotSharp\Tools\
  • Linux: godot-editor-linux-mono.zip/GodotSharp/Tools/

If you are using macOS:

  • macOS: Navigate to Godot.app/Contents/Resources/GodotSharp/Tools/ by right clicking the Godot.app file in Finder, select Show Package Contents, then navigate to Contents/Resources/GodotSharp/Tools/.

Copy the following files into your godot-nuget folder:

  • GodotSharpEditor.<version>.snupkg
  • Godot.NET.Sdk.<version>.nupkg
  • Godot.SourceGenerators.<version>.nupkg
  • GodotSharp.<version>.nupkg
  • GodotSharp.<version>.snupkg
  • GodotSharpEditor.<version>.nupkg

The <version> depends on which Godot version you downloaded, e.g. 4.1.1.


4. Create a nuget.config file

Finally, create a new file called nuget.config in the root directory of your project with the following content:

<configuration>
<packageSources>
    <!-- package source is additive -->
    <add key="godot-nuget" value="./godot-nuget" />
</packageSources>
</configuration>

This configures the godot-nuget directory to be a package source for NuGet packages. Instead of fetching the official Godot C# assemblies from the NuGet package registry, the assemblies from the godot-nuget directory will be used, which also include the C# bindings for the spine-godot runtime.


You can now open your project in Godot and use the Godot and spine-godot C# APIs instead of GDScript!


Animate a skeleton with C#

Here is simple example code to animate a Spine skeleton with a C# script attached to a SpineSprite node:

C#:

using Godot;
using System;

public partial class SpineSprite : SpineSprite {
   public override void _Ready () {
      GetAnimationState().SetAnimation("run", true, 0);
   }
}

Compared to the same code written in GDScript, there is little difference except that the API uses PascalCase and requires a semicolon at the end according to C# code conventions.

GDScript:

extends SpineSprite

func _ready():
   get_animation_state().set_animation("run", true, 0)

In GDScript, you can get the skeleton outside of a function using the @onready annotation. In C#, you cannot call the API in class definitions so you have to get it inside a function. Here is a comparison of C# and GDScript code to flip the skeleton and queue animations:

C#:

using Godot;
using System;

public partial class SpineSprite : SpineSprite {
   private SpineSkeleton spineSkeleton;
   private SpineAnimationState spineSpriteAnimState;

   public override void _Ready () {
      spineSkeleton = GetSkeleton();
      spineSpriteAnimState = GetAnimationState();
      spineSkeleton.SetScaleX(-1);
      spineSpriteAnimState.SetAnimation("idle", true, 0);
      spineSpriteAnimState.AddAnimation("run", 2, true, 0);
   }
}

GDScript:

extends SpineSprite

@onready var spineSkeleton : SpineSkeleton = get_skeleton()
@onready var spineSpriteAnimState : SpineAnimationState = get_animation_state()

func _ready():
   spineSkeleton.set_scale_x(-1)
   spineSpriteAnimState.set_animation("idle", true, 0)
   spineSpriteAnimState.add_animation("run", 2, true, 0)

For the details of how the APIs are mapped from GDScript to C#, please refer to the Godot C# documentation.


C# examples

To inspect and experiment with the C# examples for spine-godot:

  1. Clone the spine-runtimes Git repository or download the latest version as a ZIP and unzip it.
  2. Open the spine-runtimes/spine-godot/example-v4-csharp/ folder and click the project.godot file to open it.

You can find various example scenes and scripts using C# under the examples folder in the FileSystem dock.


If you are having trouble using spine-godot with C# support, don't hesitate to post your questions on the Spine Forum!

spine-godot C# support

September 5th, 2023

We're happy to announce that our spine-godot runtime now supports programming using the C# language! You are no longer limited to GDScript. C# support lets you use a feature rich IDE and can greatly increase productivity for complex games.

Please note that currently C# support in Godot 4.x is available only for desktop operating systems. As the Godot team expands platform support, our Godot binaries and export templates will be updated accordingly.

Start using C#

To get started, please visit our spine-godot documentation page and download the latest Godot + Spine binary with C# support for your operating system. Currently we provide binaries for the latest Godot stable release, which is 4.1.1.

Once you have successfully installed the Godot binary, follow the C# project setup guide to either initiate a new project or convert an existing one to utilize C# and Spine-Godot.

For more information on this topic, check out our new blog post about setting up a C# project.

Congratulations! You are now ready to develop your Godot games with Spine and C#!

Discuss this blog post on the Spine forum!