Viewing 2 reply threads
  • Author
    Posts
    • #300
      rrh
      Participant

      So I was using the Unity plugin, creating RealSpace3D AudioSources and AudioListeners, and I think the problem I was having was that I had the audio sources on gameobjects that are inactive when the scene starts and then are activated later, using a timeline animation.

      Is there some sort of registration of sounds that needs to be done, that is done automatically when the scene starts but only with the ones on active GameObjects? Is there a way for me to register these sounds in script either then, while they are still inactive, or when they become active?

    • #301
      Rod_RealSpace3D
      Keymaster

      Hello rrh,

      You can create a prefab of RealSpace3D AudioSource, and instantiate it when needed. Please refer to the sample prefab (TestPrefab.prefab) located in the /Resource folder and the sample script (PrefabSample.cs), located in /vsRealSpace3D_Scripts folder.

      Keep in mind that your “indie” license only gives you 4-5 sounds so, once they are created your count begins. So, you can create the 4-5 (can’t remember of hand how many sounds the indie license gives) prefabs but you will have to keep a reference to them if you wish to hide them in one location and then reposition and use else where.

      Also, via the API you can load new audio clips to the already created RS3D AudioSource. So, you can be creative via scripting and make your 4-5 sounds go a long way.

      Take a look at the manual if you haven’t already to see the API and samples.

      Hope this helps. Feel free to post or contact me via my email if you have any more questions,
      Rod

    • #302
      Rod_RealSpace3D
      Keymaster

      Follow up to previous answer. If you don’t wish to use prefabs and you have created your RS3D AudioSources in the Unity “Inspector” and de-selected “PlayOnStart”, then via script you can do this…

      // find all the RS3D AudioSource
      RealSpace3D_AudioSource[] theAudioSources = FindObjectsOfType(typeof(RealSpace3D_AudioSource)) as RealSpace3D_AudioSource[];

      foreach(RealSpace3D_AudioSource rs3d_AS in theAudioSources)
      {
      if(rs3d_AS != null && rs3d_AS.GetSoundSourceStarted())
      {
      rs3d_AS.rs3d_PlaySound();
      }
      }

      That will find the 3D audiosources and play them. Check out the API because if your AudioSource has multiple audio clips attached (no license limit on number of audio clips tied to audio source) you can via the rs3d_PlaySound API play the sound you wish by index or its name.

      Post back or send me email if you have difficulties, find bug(s), etc…

      -Rod

Viewing 2 reply threads
  • You must be logged in to reply to this topic.