Hi . I am making a Visual Novel with Unity 2017.1.0f1. I have set my sprites side by side and i have one Camera in the scene. I have animation clips from 1st to 2nd sprite , 2nd to 3rd sprite…etc. Animation Transition is an integer , it starts at idle state to 0. I have in Update() the Input.GetMouseButton (0) function to check the Player input . I want to move from One Animation clip to the next one after the InputGetMouseButton(0) is true and the previous animation has finished…
In summary, i want to change animation clips with the same input key.
Do you have any ideas.?
Thanks God, i found it… i am sharing the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MoveCameraWithAnimation : MonoBehaviour {
Animator anim;
private int AnimCondition=1;
void Start ()
{
anim = GetComponent<Animator> ();
}
void Update ()
{
if (Input.GetMouseButton (0)&& AnimCondition==1) {
anim.SetInteger ("move", AnimCondition);
AnimCondition += 1;
}
else if (Input.GetMouseButtonDown (0)&&AnimCondition==2)
{
anim.SetInteger ("move", AnimCondition);
AnimCondition = 3;
}
else if (Input.GetMouseButtonDown (0)&&AnimCondition==3)
{
anim.SetInteger ("move", AnimCondition);
AnimCondition = 4;
}
else if (Input.GetMouseButtonDown (0)&&AnimCondition==4)
{
SceneManager.LoadScene (3);
//anim.SetInteger ("move", AnimCondition);
AnimCondition = 5;
}
}
}