Yes I unsticked loop under animation, but nothing happens, it’ still looping.
I am trying to slide with character, but animation goes to slide then to run and so on. How do I stop this ? Here is my script.
using UnityEngine;
using System.Collections;
public class SlideScript : MonoBehaviour {
Animator slide;
// Use this for initialization
void Start () {
slide = GetComponent<Animator>();
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.S)) {
slide.SetTrigger ("Slide");
}
}
}
Here is my JumpScript, and it’s where most of my code is stored, you can take a look at that as well, maybe, this script is preventing me from doing the sliding script.
using UnityEngine;
using System.Collections;
public class JumpScript : MonoBehaviour {
public float jumpHeight;
public Transform groundCheck;
public float groundCheckRadius;
public LayerMask whatIsGround;
private bool grounded;
float jumpTime, jumpDelay = 0.6f;
bool jumped;
Animator anim;
// Use this for initialization
void Start () {
anim = GetComponent<Animator>();
}
void FixedUpdate(){
grounded = Physics2D.OverlapCircle (groundCheck.position, groundCheckRadius, whatIsGround);
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.Space) && grounded) {
GetComponent<Rigidbody2D> ().velocity = new Vector2 (0, jumpHeight);
anim.SetTrigger("Jump");
jumped = true;
}
jumpTime -= Time.deltaTime;
if (jumpTime <= 0 && grounded && jumped)
{
anim.SetTrigger ("Land");
jumped = false;
}
}
}
Sorry, was too fast when I replied. While you execute and get the wrong behavior, you can have a look at the state machine and its parameters (“Land”, “Jump”, …). Have a look at them whether they are correct at all the times. It seems to me that there is something wrong and not correctly set and reset as needed.
You have a certain logic in mind how things are supposed to work. You have the possibility to see where things get wrong when you watch the state machine and the parameters while you are actually in play mode. Like that you can identify what is going wrong.
Here is a quick example of what I mean: