Bonjour
j'ai un problème pour jouer une animation suivant une condition , mon animaion fonctionne quand j'appuies sur la barre d espace mais ne se joue pas lorsque je mets une condition,dans l'animator rien ne se passe avec la condion avec le text il reste sur la premiere animation , par contre avec la barre d'espace la deuxieme animation se joue ci joint le code
Merci de votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class animation : MonoBehaviour { public Text txt1; public Animator anim; public InputField myInputField; string txt =""; // Start is called before the first frame update void Start() { anim= GetComponent<Animator>(); } // Update is called once per frame void Update() { if(Input.GetKeyDown(KeyCode.Space)){ anim.SetBool("pour",true); } } public void change(){ txt1.text=myInputField.text; txt=myInputField.text; if (txt=="six"){ anim.SetBool("pour",true); } } }
Partager