Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by chaguaramo · Nov 18, 2013 at 11:51 PM · audiopositionaudiosource

Can I play multiple positioned audiosources with one game object?

Hi,

I am creating a scene with 160 recorded ambient sounds. Each audio source for a different position in the scene. The problem is I am exceeding the playing limit of 100 audio channels. Because the ambient sounds must be played simultaneously to stay synchronized, I created groups of audio sources to be played simultaneously. Can I add these groups of audio sources with their component properties to a new empty game object so that the audio sources attached play simultaneously when the game controller collides with the new game object (each one from their own position)? Is it possible to make the audio clips play from the last played position and not from the beginning of the clip each time when the audio source is called to play?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by chaguaramo · Apr 03, 2014 at 10:10 PM

Hi, here is a script that solve my first question and makes it possible to create audio zones with a random form. Thanks to Daniel Murcia!

For use it, create a surface with the form you need and place it on the floor level, add a mesh collider, select-on the is trigger option, unselect the mesh render option and attach to the surface you have created the audio sources you want to be played simultaneously when enter in the zone designed by your surface.

So you can differentiate audio zones that are played at once when are triggered.

 #pragma strict
 
 var audioSources;
 
 function Start(){
     audioSources = gameObject.GetComponentsInChildren(AudioSource);
 }
 function OnTriggerExit(){
     Debug.Log("stopping sounds");
     Debug.Log(this);
     var self = this;
     for (var source:AudioSource in audioSources) {
         Debug.Log(source);
         source.Stop();
     }
 }
 
 function OnTriggerEnter(){
     Debug.Log("starting sounds");
     Debug.Log(this);
     var self = this;
     for (var source:AudioSource in audioSources) {
         Debug.Log(source);
         source.Play();
     }
 }
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

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

17 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

Related Questions

Boolean and audio is not working right 1 Answer

How to fade in-out groups of audio sources? 0 Answers

In-game sound turns off when I play 0 Answers

Audio/c#/unity Can i control the duration by time ? 1 Answer

How can I pre-load samples from an audio file to spawn objects? 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