The Axie Mixer
is built upon Spine Animation but with some customization for our needs. The AxieMixer
will help you to create the SkeletonData
which you can use with Spine and use it as normal.
Spine Runtime Library
(spine-unity 3.8 2021-11-10). You need to download it manualy, and put it on Plugins folder.
- Install the package using the following Git URL:
https://github.com/axieinfinity/mixer-unity.git?path=/Packages/com.skymavis.axiemixer.unity#v0.6.3
To initialize the Axie Mixer, you need to call Mixer.Init()
only once at the start of the game. The best place for this method is in the loading scene.
Calling Mixer.Init()
multiple times will do nothing.
To create an axie spine, you will need to know the Axie Id
and its Genes
Then create an object in scene with SkeletonAnimation
component
var skeletonAnimation = GetComponent<SkeletonAnimation>();
Mixer.SpawnSkeletonAnimation(skeletonAnimation, axieId, genesStrting);
Mixer.SpawnSkeletonAnimation(
SkeletonAnimation skeletonAnimation,
string axieId,
string genesStr
)
-
skeletonAnimation
: Main spine component for rendering and controling animation -
axieId
: Axie id -
genesString
: Axie genes, must be gene 512
Tips
You might need to scale down the
SkeletonAnimation
to the desired size.To flip the Axie, please use the
scaleX
field of the skeleton. Example:skeletonAnimation.skeleton.ScaleX = -1
Creating Axie Spine for UICanvas is quite the same as above, the different is you will need to use SkeletonGraphic
instead of SkeletonAnimation
Mixer.SpawnSkeletonAnimation(
SkeletonGraphic skeletonGraphic,
string axieId,
string genesStr
)
You can get all available animation names using this snippet.
List<string> animationList = Mixer.Builder.axieMixerMaterials.GetMixerStuff(AxieFormType.Normal).GetAnimatioNames();
Playing animation.
skeletonAnimation.state.SetAnimation(0, "action/idle/normal", true);
// The above code will play Idle animation with looping
// For Skeleton Graphic
skeletonGraphic.AnimationState.SetAnimation(0, "action/idle/normal", true);
// You can find more information about the function here http://en.esotericsoftware.com/spine-applying-animations
You need add AxieMixerShaderVariants
into Preloaded Shaders (Project Settings/Graphics/Shader Loading)
In the asset, there are 2 demos that you can explore. You can find these scenes:
-
DemoMixer
: or so called PlayGround. -
FlappyAxie
: This is a minigame based on FlappyBird. In this demo, you can find theAxieFigure
class which helps to setupSkeletonAnimation
automatically. (Theaxie id
andgenes
are static though)