Cannot play disabled audio source unity

Cannot play disabled audio source unity


  • Getting Started With Game Audio
  • How to Use Audio Mixers in Unity 3D (Helpful Guide)
  • It boasts a lot of new features that will make it an even more powerful game engine. Quite a lot has changed since Unity 3 and the content of my tutorials desperately needed to get with the times. So, as of last week, I finalized and uploaded the new series to our Youtube channel. The new series can be seen here. It is split into five parts and by the end of it, you should know how to make a very primitive game that includes a first person mechanic, a shooting mechanic, terrain, skyboxes, sounds, collision, scripting, and more.

    A lot of the information is similar to the older version of Unity. In this post, I am going to talk a bit about the audio mixer and some of the things you can do with it.

    Feel free to check out the rest of the tutorials if you are interested in learning the basics of Unity 3D. An Audio Source in Unity is exactly what it sounds like; a source where audio assets play from.

    Audio Sources have a variety of settings that you can tweak to your liking. How Audio Mixer Works Audio Mixer Groups start off with only a Master channel, which controls all of the audio that is passed to the mixer. From the Master channel you are able to create children channels. You can assign audio sources to any channel you want. As you can see in the screenshot above, I have 4 different channels.

    Each one controls specific audio sources, but all of them feed into the Master Channel. So while I may individually control the volume of a specific sound effect, the Master Channel still controls the sound of all of these channels. Each child channel you make can have its own children as well. Each channel in your Audio Mixer has effects that can be applied to them.

    You can choose the effect you want and you can then modify the effects by using the Inspector on the right side of the Editor.

    Tweet In our last sojourn into game audio we covered some of the basics to bring you up to speed on how sound in games works in general, as well as taking you through how an audio asset gets designed and ready to be put into a game.

    The Mysterious Warehouse is a training game that we use all the time in our classes. An overview of the audio controls in the Unity game programming and testing environment. Simply reading this article will give you a great handle on how the fundamentals of game audio really work in practice.

    But if you want to implement these steps right away in a real game environment, you can click here to purchase the student version of the Mysterious Warehouse lesson and go through these steps yourself. PC users may want to use the free 7-Zip utility to more accurately unzip these files. Just choose your desired platform and then download and install Unity.

    There are also lots of great tutorials available directly from the Unity website. These files should be saved as bit WAV files at Our first step is to open up the Mysterious Warehouse game in Unity and navigate over to the loading area in the tiled room. When you do this, a Cube object will be created in the area you are in, as shown below. You may have to move it with the cursor tools to view it fully.

    Introducing the Audio Listener You can think of the Audio Listener as something like an avatar for your ears inside the game space. It acts as a microphone of sorts within the game world, and its main role is to mix the sounds coming at it via Audio Sources from different distances and directions.

    This is very important because Unity only supports one Listener Component in the scene at a time. You can look for this in the Hierarchy on the left side of the window. Audio Source This is the most important audio-related Component you need for hearing audio playback in Unity. As the name implies, it is a source of audio. It can also freely mix between these two paths in-game. Unity can support as many Audio Sources in a game as the hardware can handle, but usually defaults to To add an AudioSource Component in this example, we can click on the Cube object we created in either the Scene itself, or the Hierarchy menu to select it.

    You can right click on it, select Create from the menu and then New Folder. Now go find the sounds you created or appropriated and simply drag them into it. You can play these back inside Unity using the Inspector toward the bottom right in the Preview section. Note that Unity has automatically converted this file into a compressed Ogg Vorbis file to save space. Now we have something we can use in our AudioSource Component.

    Mute Mute temporarily mutes the sound. Mute can be useful when you need to isolate a particular sound from others. This setting is useful for ambience sounds or music loops. Turn or leave this option on. Loop The Loop setting, intuitively enough, causes the Audio Source to loop continuously, so it is useful for background sounds like ambiences or music. Turn this option on. Priority Priority allows you to rank sounds according to their importance. Volume Volume is the maximum volume the Audio Source will have: 1 is the highest volume possible, and 0 mutes the sound.

    Pitch The Pitch control is like a record speed control. Effectively, it adjusts the playback speed of a sound. Because speed and pitch are linked, a faster speed above 1. Next, check the Warehouse Manager script in the Inspector for this object, and make sure that Showtime is disabled on it as shown. With Showtime disabled the scene will play back in a way that will help us test the sound more easily. Manipulating Sound in Unity Alright, to play the scene—and your sound—find the Playback arrow at the top center of the main window in the center and click on it.

    You have successfully managed to play a sound inside of a game. The most important control to look at here is the Spatial Blend. What this does is maintain a constant balance between a 2D signal path, at the far left, and a 3D signal path at the far right.

    Anywhere in between is a mix between these two paths. For the AudioClip, find a music loop or perhaps an old radio show. Drag it to the Audio Clip field as we did before. Doppler and Spread are nice features to have, but are not needed at the moment.

    That point is similar—though not necessarily identical—to a setting called the Max Distance. Going further outwards past this point, the sound stops reducing in volume or attenuating. Similarly, the sound increases in volume as you get closer to the source, and at some point, you cannot effectively get any closer to the Audio Source.

    This is called the Min Distance, and it is the loudest the sound can possibly get. Think of it as a gate in front of the speakers at the front of the stage at a large rock concert. Both Min and Max Distance can be manually set in the Inspector, or by adjusting the size of two concentric spheres. The inside sphere is the Min Distance and the Max Distance is the outside sphere. How quickly or slowly the sound changes between the Min Distance to Max Distance is determined by the Rolloff curve in the graphic settings window.

    The line can be set to a preset mode, or it can be adjusted manually to create a custom curve. This graph can be used to control many other settings both on the Audio Source itself, as well as any extra added Filter Components. Interestingly, due to calculations, the curve does not actually reach zero. Linear Rolloff center draws a diagonal line. This setting may be useful if a sound is important in the game and needs to be heard from a further distance away.

    Custom Rolloff right allows you to customize the slope to your own taste. How Is Distance Measured in Unity? That brings up an interesting point—how is distance measured in Unity?

    The actual distance of a Game Unit can be determined in the Project Settings. By default, this is set at 1 meter, which means that the Cube object you created is 1 meter on each side. So this means that your Min Distance is 1 meter and your Max Distance is meters!

    This has made the act of mixing in Unity tremendously easier to manage than it was in the past. Remember that the Listener has a 3D output bus and 2D output bus, and that the Spatial Blend control on each Audio Source regulates how much of each is in its final balance. By default, the window will open as an extra tab near the Project tab. You can of course, position this tab wherever you like. Unity calls these channels Audio Mixer Groups.

    You can create these by clicking the plus sign on the upper-right corner of the Groups area on the far left. Now look at the area just to the left of the names in this area. These eye icon to the left of each group sets the visibility of that item in the mixer window. Click on these to toggle the visibility of that item on or off in the mixer.

    The Mixer should look like this when finished: Now we have to configure our Audio Source components to actually make use of these new Audio Mixer groups! In other words, this effect is Post Fader. Adjust this to the desired level. Keep in mind that the methods described above are just a couple of common approaches, and they do not apply precisely to every game development situation or engine.

    We get much deeper into all this stuff, but hurry as seats are limited and fill up fast! Meet Steve and Scott We started the Game Audio Institute based on our experience in the industry and the classroom, where we have been developing curriculum and teaching both graduate and undergraduate courses. Unfortunately, all too often these days, people are missing out on developing a solid foundation in their understanding of interactive sound and music design.

    The GAI approach is fundamentally different. We want composers, sound designers, producers and audio professionals of all kinds to be familiar and comfortable with the very unique workflow associated with sound for games and interactive environments.

    Steve Horowitz is a creator of odd but highly accessible sounds and a diverse and prolific musician. Since , he has literally worked on hundreds of titles during his eighteen year tenure as audio director for Nickelodeon Digital, where he has had the privilege of working on projects that garnered both Webby and Broadcast Design awards.

    Scott Looney is a passionate artist, soundsmith, educator, and curriculum developer who has been helping students understand the basic concepts and practices behind the creation of content for interactive media and games for over ten years. He has created compelling sounds for audiences, game developers and ad agencies alike across a broad spectrum of genres and styles, from contemporary music to experimental noise.

    In addition to his work in game audio and education, he is currently researching procedural and generative sound applications in games, and mastering the art of code. Related posts:.

    Feel free to check out the rest of the tutorials if you are interested in learning the basics of Unity 3D. An Audio Source in Unity is exactly what it sounds like; a source where audio assets play from. Audio Sources have a variety of settings that you can tweak to your liking.

    How Audio Mixer Works Audio Mixer Groups start off with only a Master channel, which controls all of the audio that is passed to the mixer. From the Master channel you are able to create children channels. You can assign audio sources to any channel you want. As you can see in the screenshot above, I have 4 different channels. Each one controls specific audio sources, but all of them feed into the Master Channel.

    So while I may individually control the volume of a specific sound effect, the Master Channel still controls the sound of all of these channels. Now go find the sounds you created or appropriated and simply drag them into it. You can play these back inside Unity using the Inspector toward the bottom right in the Preview section. Note that Unity has automatically converted this file into a compressed Ogg Vorbis file to save space.

    Now we have something we can use in our AudioSource Component. Mute Mute temporarily mutes the sound.

    Mute can be useful when you need to isolate a particular sound from others. This setting is useful for ambience sounds or music loops. Turn or leave this option on.

    Loop The Loop setting, intuitively enough, causes the Audio Source to loop continuously, so it is useful for background sounds like ambiences or music. Turn this option on. Priority Priority allows you to rank sounds according to their importance.

    Volume Volume is the maximum volume the Audio Source will have: 1 is the highest volume possible, and 0 mutes the sound.

    Pitch The Pitch control is like a record speed control.

    Getting Started With Game Audio

    Effectively, it adjusts the playback speed of a sound. Because speed and pitch are linked, a faster speed above 1. Next, check the Warehouse Manager script in the Inspector for this object, and make sure that Showtime is disabled on it as shown. With Showtime disabled the scene will play back in a way that will help us test the sound more easily. Manipulating Sound in Unity Alright, to play the scene—and your sound—find the Playback arrow at the top center of the main window in the center and click on it.

    You have successfully managed to play a sound inside of a game. The most important control to look at here is the Spatial Blend.

    What this does is maintain a constant balance between a 2D signal path, at the far left, and a 3D signal path at the far right. Anywhere in between is a mix between these two paths.

    How to Use Audio Mixers in Unity 3D (Helpful Guide)

    For the AudioClip, find a music loop or perhaps an old radio show. Drag it to the Audio Clip field as we did before. Doppler and Spread are nice features to have, but are not needed at the moment. That point is similar—though not necessarily identical—to a setting called the Max Distance. Going further outwards past this point, the sound stops reducing in volume or attenuating.

    Similarly, the sound increases in volume as you get closer to the source, and at some point, you cannot effectively get any closer to the Audio Source. This is called the Min Distance, and it is the loudest the sound can possibly get. Think of it as a gate in front of the speakers at the front of the stage at a large rock concert. Both Min and Max Distance can be manually set in the Inspector, or by adjusting the size of two concentric spheres.

    The inside sphere is the Min Distance and the Max Distance is the outside sphere. How quickly or slowly the sound changes between the Min Distance to Max Distance is determined by the Rolloff curve in the graphic settings window. The line can be set to a preset mode, or it can be adjusted manually to create a custom curve. This graph can be used to control many other settings both on the Audio Source itself, as well as any extra added Filter Components.

    Interestingly, due to calculations, the curve does not actually reach zero. Linear Rolloff center draws a diagonal line. This setting may be useful if a sound is important in the game and needs to be heard from a further distance away. Custom Rolloff right allows you to customize the slope to your own taste. How Is Distance Measured in Unity? That brings up an interesting point—how is distance measured in Unity? The actual distance of a Game Unit can be determined in the Project Settings.

    By default, this is set at 1 meter, which means that the Cube object you created is 1 meter on each side.

    So this means that your Min Distance is 1 meter and your Max Distance is meters! This has made the act of mixing in Unity tremendously easier to manage than it was in the past.


    thoughts on “Cannot play disabled audio source unity

    Leave a Reply

    Your email address will not be published. Required fields are marked *