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

Sound Sources

Discussion in 'Project Tiny' started by TheFordeD, Feb 14, 2019.

  1. TheFordeD

    TheFordeD

    Joined:
    Jul 9, 2018
    Posts:
    32
    How add, play, pause and stop sound in Tiny?
     
  2. alamac123

    alamac123

    Joined:
    Mar 15, 2017
    Posts:
    22
    I am also waiting for an answer to this question.
     
  3. Rupture13

    Rupture13

    Joined:
    Apr 12, 2016
    Posts:
    131
    To add sound, add the AudioSource component to an entity.
    To play and stop that sound, add the AudioSourceStart and AudioSourceStop components respectively to the same entity. These components will automatically remove itself after doing their job.

    If you want your AudioSource to start automatically when the entity is loaded, make sure to have the AudioSourceStart component already on the entity in the inspector.

    Making audio start from code would be something like this:
    Code (CSharp):
    1. this.world.addComponent(entity, ut.Audio.AudioSourceStart);
     
    Last edited: Feb 15, 2019
    TheFordeD likes this.