- Home /
Question by
ziad23 · Mar 15, 2019 at 04:04 PM ·
c#scripting problemmovementaudioaudiosource
audio doesn't play on movement
i try to play footsteps audio on movement but it doesn't play, can someone help please?
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class footsteps2 : MonoBehaviour { CharacterController player; bool isMoving = false; AudioSource foot; // Start is called before the first frame update void Start() { foot = GetComponent(); player = GetComponent();
}
// Update is called once per frame
void Update()
{
if (player.velocity == Vector3.zero)
{
isMoving = false;
}
else
{
foot.Play();
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Audio Clip Playing every frame 2 Answers
Making a bubble level (not a game but work tool) 1 Answer
Problem with audio 1 Answer
Change AudioSource output via Script 1 Answer
Glitched Music 0 Answers