- Home /
using sample assets beta, how to add animation to the third person character?
Hi everyone,
I'm using sample assets beta as Template and i'm trying to add some animations to the already made third person character. It uses 2 scripts in csharp one "third person character" and one "thrid person user" to control the model. I changed the model, and now i'm trying to make him attack.
So i first went to the Animator and add a state called "low kick" made transitions from grounded, i created a bool called lowkick and when i check the little box my player plays the lowkick move looping it, so to me it's ok.....then uncheck the bool box in the window...
I've made a java script for the lowkick move but the console says: "there is no animation attached to the gameobject but a script is triing to access it", here is the javascript of the lowkick
#pragma strict
function Start () {
animation["kick_22"].layer = 1
animation["kick_22"].wrapmode=wrapmode.once;
}
function update () {
if (Input.Getkeydown("l")){
Maybe i should create a reference to the animator in my java script???? i tried but didnt find the right words! lol I promise i've tried to find by myself since 1 week with no result!! i'm noob and not very clever obviously!!
Can somebody check the free sample assets beta scripts and give me some advice or maybe THE solution! Graphicly my little project is quite good but i need to add animation to my model and dont want to go back using a different controller or animator it looks like gta gameplay and i love it!!
thats why i need some help
many thanks in advance!
peace out
eaque
Answer by Ezio1302 · Jan 09, 2015 at 01:09 AM
Sorry if this question is somewhat old...
You are correct, you need to include a reference to your animator component. All you need to do is add one line:
var myAnimator : Animator;
Then you attach the script to the desired object, and drag and drop your Animator Component onto the variable.
Hope this helps!