Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

How do I fix this broken walking animation start in C#?

$
0
0
Hello all, Here is an extremely basic C# script that I wrote to test out a walking animation. I will go back later in the project and hopefully add booleans to control it so I can add jumping animations and the like. I have the walking animation all done. It is attached to the pistol model, and to make sure I dragged the animation to the pistol as well. I then dragged this script to it. I click play and it just plays the animation over and over no matter what I do. I just want some light shed on what I am doing wrong. Thanks. using UnityEngine; using System.Collections; public class walkinanimationpistol : MonoBehaviour { void Update () { if (Input.GetKeyDown ("w")) { animation.Play("NameOfWalkingAnim"); } else { animation.Stop("NameOfWalkingAnim"); } } }

Viewing all articles
Browse latest Browse all 171066

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>