Unity & FMOD v2.02.00 - v2.02.06 | How To Use EventReferences & PlayOneShotAttached();

  Рет қаралды 3,168

Scott Game Sounds

Scott Game Sounds

2 жыл бұрын

NOTE: IF YOU'RE USING FMOD V2.02.07 OR HIGHER, YOU DON'T NEED TO CHANGE ANYTHING IN THE RUNTIME MANAGER SCRIPT
Hello all! Just a quick video on how to edit your Unity project so that you can use FMOD's 'FMODUnity.RuntimeManager.PlayOneShotAttached();' function with the 'EventReference' system.
Here is the new function that you'll need to copy and paste into your RuntimeManager script:
public static void PlayOneShotAttached(EventReference eventReference, GameObject gameObject)
{
try
{
PlayOneShotAttached(eventReference.Guid, gameObject);
}
catch (EventNotFoundException)
{
RuntimeUtils.DebugLogWarning("[FMOD] Event not found: " + eventReference.ToString());
}
}
Sign Up To The Newsletter For A Free FMOD + Unity Lesson!: scottgamesounds.us7.list-mana...
Check Out Other Series Such As:
Adding Game Sounds | FMOD & Unity: • Adding Game Sounds Fro...
Sound Design Tutorials: • Sound Design Tutorials
Dynamic Footstep System | Different Sounds On Different Surfaces - Unreal Engine 4 Tutorial: • Dynamic Footstep Syste...
Please let me know if you enjoyed. :D
Feel free to email me at henry@scottgamesounds.com. Or follow me on twitter @henryscott0.
My Music: / henry-scott-12. .
My Site: www.scottgamesounds.com

Пікірлер: 17
@homemacai
@homemacai 2 жыл бұрын
lol , the camera picture slowly changing was great. The giga chad of fmod.
@ScottGameSounds
@ScottGameSounds 2 жыл бұрын
Yes! So happy someone noticed :D
@MartyMcFlyTop1
@MartyMcFlyTop1 2 жыл бұрын
Thank you! Your work is very important
@ScottGameSounds
@ScottGameSounds 2 жыл бұрын
Thanks a bunch Marty McFly! Appriciate your nice words :)
@aquqa_remix
@aquqa_remix 2 жыл бұрын
Many thanks for all the tutorials and this guidance, rescued a coding newbie from confusion. By the way just would like to know if the PlayOneShot() and PlayOneShotAttached() functions both work well on general UI sounds, like those button clicking sounds with default panning?
@ScottGameSounds
@ScottGameSounds 2 жыл бұрын
Thanks a lot AQuQA! Yeah honestly for 2D Ui sounds with no volume or panning attenuation you can use either. Just use which ever on your prefer. Personally I prefer attached, as all you have to do is write 'gameObject' as the second argument and it works. Thanks for watching the videos 📹
@kicoming9302
@kicoming9302 2 жыл бұрын
hi Henry, thank you for these videos but I would like to know what you think about fmod performance optimization, such as the large number of bullet events (maybe hundreds) in some FPS games that will crash when running on mobile. Or if you have encountered a similar situation (not just the one I mentioned), how would you deal with it? This is a common problem faced by sound designers and programmers👏
@ScottGameSounds
@ScottGameSounds 2 жыл бұрын
Hey KicominG. So FMOD has a system that allows you to limit how many times each event you create can play at once. Lets say you create an event that plays a BANG sound whenever a fully automatic AK-47 is shot in an FPS game. If lots of enemies are firing that gun then that one event is going to be played a lot. This can not only sound really messy and get really loud, but can also negativly affect performance. Well if you were to click on that event on FMOD and look in the bottom right corner of the screen you should see a setting called something like "max instances" which lets you set the max amount of times that event can be played at once. So instead of leaving it on its default of infinity, you'd reduce it to say 10. That means there are 10 instances of the BANG sound that can play at once and if the game tried to play an 11th (say if an 11th enemy fired their gun) FMOD wouldn't allow it. This reduces CPU usage, reduces the loudness of all of the guns, and surprising still sounds believable to the player. Turns out you don't need to hear every single bullet shot for the overall sound of a gun fight to feel believable. Hope that helps you KicominG.
@kicoming9302
@kicoming9302 2 жыл бұрын
@@ScottGameSounds OK! Thanks for your answer! I know the relevant setting for "max instance".But what I want to know is that, for example, if I bind a sound to a bullet and set the "max instance" to 10, there are hundreds of bullets in the same area in a certain scene in the game at the same time, and the mobile terminal will also generate Crash, do I have to use some "cheating" way to achieve this effect, like the sound is not bound to the bullet?By the way, I'm used to using "Virtualize". It is said to take up resources. Although it dosnt make a sound, if I don't use "Virtualization", the sound will be very unnatural for events like "Consecutive Weapons". It's actually a trade-off, and I want to know the best of both worlds.
@ScottGameSounds
@ScottGameSounds 2 жыл бұрын
@@kicoming9302 Sorry KicominG, I don't quite understand your message. What exactly is the problem that you're trying to fix? I don't understand what you mean by "generate Crash". What exactly is the "effect" that you're trying to achieve? thanks
@kicoming9302
@kicoming9302 2 жыл бұрын
@@ScottGameSounds Sorry for my bad description, to be precise, my project wants to achieve the effect of bullets flying all over the sky, these bullets will make sounds to me and the things around me, it seems that the "max instance" limit is not enough (the mobile terminal will crash), the programmer and I are confused by this
@iangiedrojc
@iangiedrojc 2 жыл бұрын
How is this different from using FMOD Studio Event Emitter script? If I'll put it in the cube it pans the 3D sound and it doesn't require any code.
@ScottGameSounds
@ScottGameSounds 2 жыл бұрын
Hey Ian. Yes you can use the Studio Event Emitter and you'll be able to play your sounds very easily with it. However sometimes you might find that you'll want to trigger your sound to play in a very specific scenario. For example, if the players health is below 5 points after 10 minutes of gameplay when they've collected all 100 coins. In cases like these, the Studio Event Emitter won't be able to play your sounds at this exact moment, but by using code and the PlayOneShotAttached function you can. Does that help? Sorry for the late reply
@ppk2373
@ppk2373 2 жыл бұрын
ThankYoU! But how to check to ensure it is being played once? ty
@ScottGameSounds
@ScottGameSounds 2 жыл бұрын
Hey PP k. You can use the FMOD profiler for this. Using the profiler, you can connect your FMOD project to your game and monitor how many instances of an event are being played at once. If you copied what I did in the video then its very likely that the event is only being played once
@bourbonbristles
@bourbonbristles 2 жыл бұрын
I haven't tested but based on your solution, shouldn't you just pass "sound.Guid" to "PlayOneShotAttached(sound.Guid, gameObject)" instead? Modifying the FMOD source has to be overkill... (if you wanted to keep the same API you could use an extension method) still, big fan of your videos, they have definitely helped me previously.
@ScottGameSounds
@ScottGameSounds 2 жыл бұрын
Hey Daniel. Yes you absolutely can just use the PlayOneShotAttached(sound.Guid, gameOnbject) method that they provide you with instead. The reason why I made this video was because I had a lot of people asking me way they couldn't just pass through their EventReference fields directly into playoneshotattached, especially considering the fact that you can easily do this for the PlayOneShot function. This lead me to believe that a lot of designers find it perhaps more intuitive to use EventReference over sound.Guid. But hey, to each there own I suppose. Thanks for watching and supporting the channel Daniel!
FMOD & Unity | Visualise And See Your 3D Sound Sources
28:31
Scott Game Sounds
Рет қаралды 1 М.
버블티로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 117 МЛН
MEGA BOXES ARE BACK!!!
08:53
Brawl Stars
Рет қаралды 36 МЛН
아이스크림으로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 53 МЛН
Elon Musk fires employees in twitter meeting DUB
1:58
GeoMFilms
Рет қаралды 13 МЛН
How to make an Audio System in Unity | Unity + FMOD Tutorial
49:37
Shaped by Rain Studios
Рет қаралды 48 М.
Bob Nystrom - Is There More to Game Architecture than ECS?
23:06
Roguelike Celebration
Рет қаралды 194 М.
Attaching GameObjects with Audio Events in FMOD and Unity
6:37
Point Blank Music School
Рет қаралды 13 М.
Playing FMOD Events in Unity (FMOD + Unity Tutorial)
11:07
Alessandro Famà
Рет қаралды 8 М.
Use Arc Instead of Vec
15:21
Logan Smith
Рет қаралды 138 М.
Unity Playables is Actually a Game-Changer
13:47
git-amend
Рет қаралды 14 М.
버블티로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 117 МЛН