Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. The 2023.1 beta is now available for testing. To find out what's new, have a look at our 2023.1 feature highlights.
    Dismiss Notice

Question AudioClip component

Discussion in 'Project Tiny' started by RoughSpaghetti3211, May 7, 2021.

  1. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,688
    Wondering if someone could help me out. Im looking at tiny audion, in the class ConvertAudioClipAsset I see a AudioClip component DstEntityManager.AddComponentData<AudioClip>(entity, tinyAudioClip); but where is that AudioClip : IComponentData? What am i missing here?
     
  2. Rangerz132

    Rangerz132

    Joined:
    Feb 3, 2019
    Posts:
    34
    Hi @francois85 , I hope it is not too late but when I use any dynamic audio elements, I use an empty gameObject with a component attached to it called 'AudioManager'. Under this empty gameObject I have many gameObject (Entity) with a AudioSource component attached with the PlayOnAwake disabled.

    I created an Entity in the AudioManager component for each dynamic sound under the AudioManager gameObject in the hierarchy.

    If I want to play a specific sound I simply to that:

    var audioManager = GetSingleton<AudioManager>();

    // Add combo multiplcator sound
    EntityManager.AddComponent<AudioSourceStart>(audioManager.multiplierSound);
     

    Attached Files:

  3. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,688
    O nice thank you, never too late to learn something new
     
    Rangerz132 likes this.
  4. Rangerz132

    Rangerz132

    Joined:
    Feb 3, 2019
    Posts:
    34
    Let me know if you still have some issues about that.