Hey guys,
I’m new to C# so I don’t know how to fix a problem. I scripted something into my CharacterController, which plays a sound when a specific button is pressed, but i get the Error CharacterController.jumpSound' is a
field’ but a `type’ was expected.
This is the important part of the code:
using UnityEngine;
using System.Collections;
public class CharacterController : MonoBehaviour {
//soundfx
public AudioClip[] walkSound;
void Update ()
{
if(Input.GetKeyDown(KeyCode.A))
{
PlayWalkSound();
}
}
void PlayWalkSound()
{
audio.clip = walkSound[];
audio.Play ();
}
}
What do I need to do so it will work?