- Home /
Accessing FBX Animation Sub Clips
So I have a Main Character, CharA.fbx, and a file called CharA@TestAnims.fbx which contains 10 animations. (This is a test I did, in reality I have 6 Files which 20+ takes each, which makes it very cumbersome to separate out)
I've tried Adding an animation object to the character, I've tried to play it with
animation.Play(CharA@TestAnims.Walk) animation.Play(CharA@TestAnims.Run) animation.Play(CharA@TestAnims.Jump)
and
animation.Play(CharA@TestAnims[0])
and
animation.Play(CharA@TestAnims) in the hopes that it would play them all in sequence.
all it states is that it can't find the animation I want to play.
nothing seems to direct me in how to dig into an FBX with multiple FBX animations (takes) in a file. Separating each animation out into a file seems silly since the editor can obviously see and access them, sine I can drag one onto the character and it plays continuously when I hit Play. The Question is how do you do it from code.
Answer by DCrosby · Mar 09, 2014 at 05:45 AM
So it seems like there may be an answer, because you can play the individual clips, by selecting them and playing them as the default animation for the character, but the syntax escapes me, and it seems like people are moving over to mechanim in droves. So my followup request is to post any examples of triggering mechanim sequences via code. I have the following to offer, which I will try and approve upon.
In C#
using UnityEngine;
using System.Collections;
public class AnimScript : MonoBehaviour {
public Animator animator;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey("h"))
{
animator.Play("CharA");
}
if (Input.GetKey("j"))
{
animator.SetTrigger("CharB");
}
}
}
I still don't know which one is better and what the implications as far as blending are with SetTrigger / VS / Play
Your answer
Follow this Question
Related Questions
Download and save .ogg - Files 2 Answers
How do I save and load big procedural generated terrains? 1 Answer
Read external files from resources 2 Answers
Why doesn't my copy of Unity 3D work on Windows 8? 1 Answer
How to load a single GameObject from an AssetBundle without a specific name ? 0 Answers