J'ai réalisé un personnage avec Mixamo avec plusieurs animations.
Le personnage marche, est en attente en baillant, monte et descend des escaliers ( animation de descente à faire)
Dans Inspector j'ai complété le script Animation avec celles-ci
Andromeda_baille
Andromeda_marche
Andromeda_montee_escalier
Andromeda_montee_escalier ( dupliquée de la précédente car je dois la modifiée sur Maya en descente_escalier)
Quand je lance la scène, le script me dit que les animations n'existent pas alors qu'elles sont visibles dans Project !?
Le prefab à utiliser est Pieton_9.
Clic sur Corps
Code de base
Code : Tout sélectionner
using UnityEngine;
using System.Collections;
public class PietonAnimationEscalier : MonoBehaviour {
private TrajetVl trajetVl;
public Animation anim;
public string idle, walk, montee, descente;
public bool chien;
void Start () {
if (chien)
trajetVl = transform.parent.parent.GetComponent<TrajetVl>();
else
trajetVl = transform.parent.GetComponent<TrajetVl>();
}
// Update is called once per frame
void Update () {
if (trajetVl.kmh == 0) {
anim.Play(idle);
}
if (trajetVl.kmh == 4.9) {
anim.Play(montee);
}
if (trajetVl.kmh == 4.8) {
anim.Play(descente);
}
else {
anim.Play(walk);
}
}
}
https://melanissimo-ng.din.developpemen ... dyy7I-rNMw
code erreur
Code : Tout sélectionner
The animation state Andromeda_marche could not be played because it couldn't be found!
Please attach an animation clip with the name 'Andromeda_marche' or call this function only for existing animations.
UnityEngine.Animation:Play(String)
PietonAnimationEscalier:Update() (at Assets/SCRIPT/PietonAnimationEscalier.cs:23)
Ps : J'espère être dans la bonne section cette fois-ci car j'ai le choix entre script ou animation.