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 /
  • Help Room /
avatar image
0
Question by jSlavens · Aug 27, 2016 at 12:31 AM · unity 5audio

AudioSource broken unity 5.3.5

I have an audiosource in my scene that will not play any sound. Here is the governing code: using UnityEngine; using System.Collections; using UnityEngine.SceneManagement;

 public class Menu : MonoBehaviour {
     public AudioSource menuVoiceover;
     public float countdown;
     float audioStart = 1f;
     private bool timerStarted;
     public AVProQuickTimeMovie introMovie;
     public Fader fadePlane;
     public AudioClip clip;
 
 
     //void Awake()
     //{
     //    DontDestroyOnLoad(menuVoiceover);
     //}
 
     // Use this for initialization
     void Start () {
         CharacterController playerTrans = GameObject.Find("characterControl").GetComponent<CharacterController>();
         playerTrans.mobile = false;
         menuVoiceover = GameObject.Find("Plane Audio Source").GetComponent<AudioSource>();
     }
 
     // Update is called once per frame
     void Update () {
         if (timerStarted)
         {
             countdown -= Time.deltaTime;
             audioStart -= Time.deltaTime;
         }
         if (Input.GetKeyDown(KeyCode.Space) || Input.GetButtonDown("Fire1") && timerStarted == false)
         {
             //menuVoiceover.Play();
             introMovie.Play();
             timerStarted = true;
         }
         if (countdown <= 0)
         {
             SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex + 1);
             GameObject.Find("characterControl").transform.position = (new Vector3(0, 1.169f, .761f));
             GameObject.Find("MainCamera").transform.localPosition = (new Vector3(0, .5f, 0));
             Destroy(this);
         }
         if (audioStart <= 0 && !menuVoiceover.isPlaying && timerStarted)
         {
             menuVoiceover.clip = clip;
             menuVoiceover.Play();
         }
 
 
     }
 }



I have tried just about everything. The import settings are fine and the clip will play in the editor as intended, but at runtime the audio is not there.

To answer any simple solutions

  1. I have set the clip in the editor and in code, neither worked.

  2. I have tried setting the audio source to the root of the hierarchy, still no sound.

  3. I have ensured that the audiosource settings are set to full 3d (and 2d) spacial blend.

  4. The volume is set to 1.

  5. I have set the source priority to 0.

  6. I have tried setting an output to an audio mixer.

  7. There is an audio listener in my scene attached to the camera.

  8. The audio source is enabled.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by jSlavens · Aug 29, 2016 at 05:14 PM

So it turns out that when working in VR on an Oculus headset you cannot use any other audio outputs other than the headphones built on. I was working with a nicer pair of headphones and could listen to the clips in editor, but when playing all audio has to come through the Oculus headphones.

Comment
Add comment · 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
0

Answer by Dream_in_code · Aug 27, 2016 at 04:10 AM

public AudioSource menuVoiceover;

//create an empty gameobject and store your clip there//

void Start ()

    {
     menuVoiceover = GameObject.Find("Nameoftheclip").GetComponent<AudioSource>();
    }

if (audioStart <= 0 && !menuVoiceover.isPlaying && timerStarted)

     {
          menuVoiceover.Play();
      }
Comment
Add comment · Show 1 · 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 jSlavens · Aug 29, 2016 at 03:20 PM 0
Share

Trust me, this isn't working.

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

109 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 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

How to use Unity? 1 Answer

AudioSource.Play plays every sound at once,AudioSource.Play Plays every source at once 0 Answers

Looping wav creates gap between plays 0 Answers

[Tanks Tutorial] The "engine driving" AudioClip doesn't start 1 Answer

how do i add several sounds in a unity scene? 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