Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ellibook7 · Jun 18, 2018 at 03:41 PM · wrongloop animaiton

Animation stuck in loop, how to stop?,How to stop Animation?

Hello, im pretty new to Unity so i thought id follow a tutorial about climbing. It works but when you start the animation it keeps looping. Please help.

Heres the video: https://www.youtube.com/watch?v=ffy6tog8cfw

Heres the code:

public class ClimbUp : MonoBehaviour {

 private bool canClimb;
 private Rigidbody rb;
 private RigidbodyFirstPersonController cc;
 public Animator anim;
 public Camera parkourCam;
 public Camera regularCam;


 // Use this for initialization
 void Start () {
     rb = GetComponent <Rigidbody> ();
     cc = GetComponent <RigidbodyFirstPersonController> ();

 }
 
 // Update is called once per frame
 void Update () {
     if (canClimb && Input.GetKeyDown (KeyCode.E)) {
         regularCam.depth = 0;
         parkourCam.depth = 1;
         cc.enabled = false;
         rb.isKinematic = true;
         anim.SetTrigger("Climb");
         StartCoroutine (afterClimb ());
     }
 }

 IEnumerator afterClimb () {
     yield return new WaitForSeconds (1);
     regularCam.depth = 0;
     parkourCam.depth = 1;
     cc.enabled = true;
     rb.isKinematic = false;
     transform.position = parkourCam.transform.position;
 }

 void OnTriggerEnter (Collider other) {
     if (other.tag == "Climb") {
         canClimb = true;
     }
 }

 void OnTriggerExit (Collider other) {
     canClimb = false;
 }

} ,So im pretty new to unity and i followed this tutorial: https://www.youtube.com/watch?v=ffy6tog8cfw It works but it continues looping the animation over and over without end! Please help.

The Code:

ing System.Collections; using System.Collections.Generic; using UnityEngine; using UnityStandardAssets.Characters.FirstPerson;

public class ClimbUp : MonoBehaviour {

 private bool canClimb;
 private Rigidbody rb;
 private RigidbodyFirstPersonController cc;
 public Animator anim;
 public Camera parkourCam;
 public Camera regularCam;


 // Use this for initialization
 void Start () {
     rb = GetComponent <Rigidbody> ();
     cc = GetComponent <RigidbodyFirstPersonController> ();

 }
 
 // Update is called once per frame
 void Update () {
     if (canClimb && Input.GetKeyDown (KeyCode.E)) {
         regularCam.depth = 0;
         parkourCam.depth = 1;
         cc.enabled = false;
         rb.isKinematic = true;
         anim.SetTrigger("Climb");
         StartCoroutine (afterClimb ());
     }
 }

 IEnumerator afterClimb () {
     yield return new WaitForSeconds (1);
     regularCam.depth = 0;
     parkourCam.depth = 1;
     cc.enabled = true;
     rb.isKinematic = false;
     transform.position = parkourCam.transform.position;
 }

 void OnTriggerEnter (Collider other) {
     if (other.tag == "Climb") {
         canClimb = true;
     }
 }

 void OnTriggerExit (Collider other) {
     canClimb = false;
 }

}

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Horschty · Jun 18, 2018 at 05:51 PM

Select the *.anim file in the explorer and in the inspector uncheck 'Loop Time'.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ellibook7 · Jun 18, 2018 at 09:01 PM 0
Share

Im sorry, again im pretty new so would you please elaborate. I searched in my file explorer for a .anim file but do not know where to look.

But thank you for the response otherwise.

avatar image Horschty ellibook7 · Jun 20, 2018 at 05:19 PM 0
Share

At 2:45 in the video when pressing the "create" button a ClimbingUp.anim file is created. That is what you have to select in the unity project explorer and then the inspector will show some properties you can edit.

alt text

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

84 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

error keeps looping (smartfox connection) even after I stop testing my game 1 Answer

Where is the problem? 0 Answers

illumination bake problem 1 Answer

I can't put animations on loop. 1 Answer

OnTriggerEnter firing late? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges