Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question AudioClip component

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

  1. RoughSpaghetti3211

    RoughSpaghetti3211

    Joined:
    Aug 11, 2015
    Posts:
    1,697
    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:
    38
    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,697
    O nice thank you, never too late to learn something new
     
    Rangerz132 likes this.
  4. Rangerz132

    Rangerz132

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