Question by
unity_gog58LKaI9W_qQ · May 16, 2020 at 02:20 AM ·
animationerroranimatortrigger
I want to animate with SetTrigger?
im a biggner please i need help. i want to make an animation to a trigger , i got this error at line 79,12 `using UnityEngine; using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour {
public Question[] question;
private static List<Question> unansweredQuestions;
private Question currentQuestion;
[SerializeField]
private Text factText;
[SerializeField]
private Text trueAnswerText;
[SerializeField]
private Text falseAnswerText;
[SerializeField]
private float timeBetweenQuestions = 1f;
[SerializeField]
private Animation animator;
void Start()
{
if (unansweredQuestions == null || unansweredQuestions.Count == 0)
{
unansweredQuestions = question.ToList<Question>();
}
SetCurrentQuestion ();
}
void SetCurrentQuestion()
{
int randomQuestionIndex = Random.Range (0, unansweredQuestions.Count);
currentQuestion = unansweredQuestions [randomQuestionIndex];
factText.text = currentQuestion.fact;
if (currentQuestion.isTrue)
{
trueAnswerText.text = "CORRECT";
falseAnswerText.text = "WRONG";
} else
{
trueAnswerText.text = "WRONG";
falseAnswerText.text = "CORRECT";
}
}
IEnumerator TranisitionToNextQuestion ()
{
unansweredQuestions.Remove(currentQuestion);
yield return new WaitForSeconds(timeBetweenQuestions);
SceneManager.LoadScene (SceneManager.GetActiveScene().buildIndex);
}
public void UserSelectTrue ()
{
animator.SetTrigger ("True");
if (currentQuestion.isTrue)
{
Debug.Log("CORRECT!");
} else
{
Debug.Log("WRONG");
}
StartCoroutine (TranisitionToNextQuestion());
}
public void UserSelectFalse()
{
if (!currentQuestion.isTrue)
{
Debug.Log("CORRECT!");
} else
{
Debug.Log("WRONG");
}
StartCoroutine (TranisitionToNextQuestion());
}
}
Comment
Your answer
Follow this Question
Related Questions
Unity Editor Animator Not Set To Instance Of Object 0 Answers
Trigger the Animation #2 after Animation #1 was triggered 0 Answers
Apk on android does not start. Reason: Animator | Не запускается Apk на андройд. Причина: Animator 0 Answers
Animation Trigger (Rpg Kit) 1 Answer
Error no animation attach to bear 0 Answers