<aside> 🚫 Google Chromeでは、Google翻訳がうまく機能しません。
もしこのページを翻訳したい場合は、このGitHubのページに行って、代わりにREADME.mdファイルを翻訳してください。 また、代わりに翻訳するためにFirefoxのプラグインを使用してみることができます. https://github.com/hai-vr/av3-animator-as-code#animator-as-code
</aside>
Animator As Code is a small Unity Editor facility to generate Avatars 3.0 Animator layers and animations from a fluent builder syntax written in C#.
Describing your animators as code provides the following advantages:
It is written with VRChat Avatars 3.0 use cases in mind; the API is opinionated to facilitate writing such animators in a concise way, hopefully requiring as little additional tweaking.
This is a work in progress, I am looking for feedback!
Join the Invitation Discord Server!
There are currently no releases.
Clone the repository within a subfolder of your Unity project, or download the source code and install in any subfolder of your project.
The project can be located within Assets/AnimatorAsCodeFramework
but you can choose any location.
<aside> ℹ️ The usage manual is on GitHub!
</aside>
Animator As Code contains an example scene in Examples/.
This is a good place to start.
This example shows:
public class GenExample0_ToggleGo : MonoBehaviour
{
public VRCAvatarDescriptor avatar;
public AnimatorController assetContainer;
public string assetKey;
public GameObject item;
}
private void Create()
{
var my = (GenExample0_ToggleGo) target;
// The avatar is used here:
// - to find the FX playable layer animator, where a new layer will be created.
// - to resolve the relative animation path to the item.
// The generated animation files are stored in the asset container.
var aac = AacExample.AnimatorAsCode("Example 0", my.avatar, my.assetContainer, my.assetKey, AacExample.Options().WriteDefaultsOff());
// Create a layer in the FX animator.
// Additional layers can be created in the FX animator (see later in the manual).
var fx = aac.CreateMainFxLayer();
// The first created state is the default one connected to the "Entry" node.
// States are automatically placed on the grid (see later in the manual).
var hidden = fx.NewState("Hidden")
// Animation assets are generated as sub-assets of the asset container.
// The animation path to my.skinnedMesh is relative to my.avatar
.WithAnimation(aac.NewClip().Toggling(my.item, false));
var shown = fx.NewState("Shown")
.WithAnimation(aac.NewClip().Toggling(my.item, true));
// Creates a Bool parameter in the FX layer.
// Parameters are added to the Animator if a parameter with the same name
// does not exist yet.
var itemParam = fx.BoolParameter("EnableItem");
// Transitions are created with a set of default values
// That can be changed in the Generator settings (see later in the manual).
hidden.TransitionsTo(shown).When(itemParam.IsTrue());
shown.TransitionsTo(hidden).When(itemParam.IsFalse());
}