-
Notifications
You must be signed in to change notification settings - Fork 0
How to use in Unity
- Create a folder
AvatarAnimatorin your Unity project. - Copy All files in the Unity/ folder of this repo into your project.
- Also Copy PlayerAnimatorCore.cs and Utils.cs into your project.
- On an Unused GameObject, outside an avatar, add
AvatarAnimatorTestScriptto be able to tests AvatarAnimator on your Avatar directly in Unity.
- If not already done, create an
Animator Controllerand apply it on your Avatar Animator. - Add the script
Avatar Animator Data Containeron the same GameObject that the Animator.

-
Create or rename the layer to start with
AvatarAnimator.- If you create it, don't forget to set it's weight to 1.
- You can create multiple Layers as long as they start by
AvatarAnimator.
-
Add your Animation clips and the transition between them. (Read
How to make transitionsbelow) -
In the Parameters tabs, you can add different types of parameters that are handle by the mod.
- As Tigger:
Input=...
Put this to animate using your inputs.
Input=<Type>:<Key1>(+<Key2>);<Type>:<Key>
<Type>: Keyboard, Controller
<Key>:
Keyboard:<KeyCodeName> KeyCodeNames
Controller:<ControllerInputs> ( A B X Y LeftGrip RightGrip LeftTrigger RightTrigger Menu SecondaryMenu LeftThumbStick RightThumbStick LeftTouchPad RightTouchPad)
Exemple: Input=Keyboard.Y;Controller.LeftThumbStick
-
As Int:
Random(max)
Put this to select a random transition among multiple.
Changemaxto the number of transitions from a state.
And for each transition set it toEqualsand a coresponding number between 0 and Max-1. -
As Float:
Health
Put this to Animate using the health of your avatar. -
As Float:
Timer
Put this to play an animation after some time.
And for each transition set it toGreaterand the number of sec -
As Int:
Cyclic(Count)
Put this to select a transition cyclicly among multiple.
ChangeCountthe number of transition from a state.
And for each transition set it toEqualsand a coresponding number between 0 and Count. -
As Tigger:
WaitEndClip
Put this to wait for the clip to stop playing completly once before allowing the state change.
Once done, add in the transition, the condition(s) to change to the next state.

If a transition doesn't have a condition don't forget to chech Has Exit Time otherwise it will be stuck on this transition. And if it has condition(s) uncheck it.
To Trigger a transition to another animation clip, you have to validate all Conditions. If you want to have multiple conditions but only a part are required to trigger the transition, simply add other(s) transition between the same animations with each part of the condition.
It is possible to have an Animation without transitions IN and/or OUT. In that case, this animation can only be played or exited manually.

This is the most simple way to set transitions between multiple Animation. Doing this can allow you to use only one trigger Input to iterate through every animation. But you have to play every animation that are between the animation that you want and the one currently playing.

For this one you can ether use multiple Inputs for each Out transitions or use Random or Cyclic to select one using only one Input.

All the logs of the buttons are writen in the mini console below the buttons.
-
Once you are done with the Animator Controller, push the
Populate Databutton.
This will trigger the collect of the Controller data and check if there is any mistake.
Each red messages indicate an error that must be corrected. -
You can use the
Test Databutton to look at the collected data. -
Once your are done, use
Serialize Datato store the data of your Controller as a string inSerialized Datafield. -
You can now pack the pallet like normal.
Audio clip can also be played using Animation clip. To do that,
- Import your audio clip(s).
- Add on your Avatar an
Audio Sources, add your audio clip, checkPlay on Awakeand Disable the component.

- Go into your Animation clip and add the property
Audio Sources.Enabled. - at 0.00 Disable, 0.01 Enable, <Clip Duration> Disable.

Note: If you want the audio to only be played once, you can ether uncheck Loop Time of the Animation clip or duplicate the layer and clips with uncheck loop. In this precise case, you dont have to name the layer to start with AvatarAnimator since it's a copy of all the states, transitions and transitions conditions, if the conditions are validate in one layer it's validate in every layer. But it can produce desync if a state is played manually.

If not already done, Add on an unused GameObject and outside Avatar, AvatarAnimatorTestScript. (It's normal that it's empty read the rest.)
To test your Animation on your avatar, once you use Serialize Data, Simply play your Unity project.
In the Unity tab Game not scene you can use your keyboard to test your transition. (Controller input are not available here)
Select the GameObject with the script AvatarAnimatorTestScript and like the image above, if everything was done correctly, just select the name of your avatar and manually change the state of your avatar.
Health, Cyclic and Random parameters are not automatically set after a transition like in the mod. They must be set manually using the test script.
In the Bonelib menu there is a Menu for AvatarAnimator. Inside you can Play an animation manually.