title: Unity Unexpected Sound Behavior
body: <p>Im taking a Unity C# course on Udemy, and we got to an challenge and i came up with a very simple "game". My problem is i can't figure out why no sound is playing? I looked at the instructors code and is the same as my (or did i just miss something?)</p>
  
  <p>When i press on space the rocket starts flying (this works) and should play sound (it doesnt). Yes i got a SoundListener attached to the main camera.
  Can somebody help and explain me where i missed something?</p>
  
  <p><a href="https://i.stack.imgur.com/Xgxcl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xgxcl.png" alt="Image of my game (if you cant call it so)"></a></p>
  
  <p>Here is my code that i wrote:</p>
  
  <pre><code>using System;
  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class Rocket : MonoBehaviour
  {
  
      Rigidbody rigidBody;
      AudioSource audioSource;
  
      // Use this for initialization
      void Start()
      {
          rigidBody = GetComponent&lt;Rigidbody&gt;();
          audioSource = GetComponent&lt;AudioSource&gt;();
      }
  
      // Update is called once per frame
      void Update()
      {
          ProcessInput();
      }
  
      private void ProcessInput()
      {
          if (Input.GetKey(KeyCode.Space)) // can thrust while rotating
          {
              rigidBody.AddRelativeForce(Vector3.up);
              if (!audioSource.isPlaying) // so it doesn't layer
              {
                  audioSource.Play();
              }
          }
          else
          {
              audioSource.Stop();
          }
  
          if (Input.GetKey(KeyCode.A))
          {
              transform.Rotate(Vector3.forward);
          }
          else if (Input.GetKey(KeyCode.D))
          {
              transform.Rotate(-Vector3.forward);
          }
      }
  }
  </code></pre>