I think this is the true genius of this tutorial - as my problem with bullets and explosions was me keep trying to tie explosion sounds to either bullets or explosion impactEffects that get destroyed in the world and Unity bitches about cannot play a null audio etc so yeah wow smart solution I need to now try this. Subscribed
but I want this for like bullets hitting and exploding on a surface and an impacteffect particle system gets instantiated and then like all the gameObjects like my "bullet" and my "explosion" disappear - so I am guessing that instead of my audiosource being a gameObject I should make it a prefab? But wait a minute your tutorial is really good - as I was looking at this initially the wrong way - like I was focusing too much on tying my "explosion" to the bullet or impactEffect which gets destroyed - and Unity of course bitches about unable to play a null sound and all that B.S. - so aha, keep the audioSource as like it's own separate public gameObject and have the script refer to it - but even when the bullet and the impactEffect get destroyed, my audio gameObject "remains" in the game and no more audio errors? thanks a million. I'll try it.
Do you have any code methods where when the player collides with an enemy it knocks the player backwards a bit with a stun? Kinda like old mega man and castlevania games for example
yeah - just like bullets and impactEffects that disappear from the world are handled via prefabs, I'm now inclined to conclude - that my audioSource instead of a gameObject sitting in the hierarchy - needs to be also a prefab - and I need to code an instantiation of the audioSource prefab that gets played when the bullet collides with a target I want it to "ricochet" off etc. hmm. ok you really set me on the right path with this thanks - this is a b*tch for when you want to apply to objects that get destroyed like projectiles and explosions - they are there one update loop but then gone on the next iteration of update lol
I'm going bonkers, I tried several things in my 2D Panchinko project to get a sound to play when the ball collides with one of the pegs, nothing is working, I have tried with and without tags, moving code around in C#, moving the order of components, literally nothing is working, the sound simply won't play and I don't know why :/
@@jazhinx yes I did actually, I used a script I found that some lady made here on RUclips of a ball falling on a trampoline in 2D, it was way simpler than I thought it would be lol
Thanks so much! Didn't know I could use this on games, used it on a coding assignment last year, lol!
Thanks buddy, I've been searching for so long, for a good tutorial simple and working
Thank you so mush! Creating a new gameobject solved my problem.
I think this is the true genius of this tutorial - as my problem with bullets and explosions was me keep trying to tie explosion sounds to either bullets or explosion impactEffects that get destroyed in the world and Unity bitches about cannot play a null audio etc so yeah wow smart solution I need to now try this. Subscribed
but I want this for like bullets hitting and exploding on a surface and an impacteffect particle system gets instantiated and then like all the gameObjects like my "bullet" and my "explosion" disappear - so I am guessing that instead of my audiosource being a gameObject I should make it a prefab? But wait a minute your tutorial is really good - as I was looking at this initially the wrong way - like I was focusing too much on tying my "explosion" to the bullet or impactEffect which gets destroyed - and Unity of course bitches about unable to play a null sound and all that B.S. - so aha, keep the audioSource as like it's own separate public gameObject and have the script refer to it - but even when the bullet and the impactEffect get destroyed, my audio gameObject "remains" in the game and no more audio errors? thanks a million. I'll try it.
Thanks bro!
Thanks buddy but jumpscare is something different from scaresound!
Thank you
perfect vid thanks bro
Cheers Boss!
Thanks a ton, it helped
God thanks!
Do you have any code methods where when the player collides with an enemy it knocks the player backwards a bit with a stun? Kinda like old mega man and castlevania games for example
Great
does the audio file have to be a specific type? i did everything you said but wont let me put the audio file into the audio player
Yeah, the audio file formats that Unity can import are .aif, .wav, .mp3, and .ogg
yeah - just like bullets and impactEffects that disappear from the world are handled via prefabs, I'm now inclined to conclude - that my audioSource instead of a gameObject sitting in the hierarchy - needs to be also a prefab - and I need to code an instantiation of the audioSource prefab that gets played when the bullet collides with a target I want it to "ricochet" off etc. hmm. ok you really set me on the right path with this thanks - this is a b*tch for when you want to apply to objects that get destroyed like projectiles and explosions - they are there one update loop but then gone on the next iteration of update lol
I'm going bonkers, I tried several things in my 2D Panchinko project to get a sound to play when the ball collides with one of the pegs, nothing is working, I have tried with and without tags, moving code around in C#, moving the order of components, literally nothing is working, the sound simply won't play and I don't know why :/
did u solve this problem?
@@jazhinx yes I did actually, I used a script I found that some lady made here on RUclips of a ball falling on a trampoline in 2D, it was way simpler than I thought it would be lol
@@dj_tika i see, lookin' for that then HAHA tysm
@@dj_tika how’s the game going mow
How do I get my enemy to play a sound when my player gets close to the enemy?
do a raycast and use raycast.length whatever it is to set the "distance"
Works
i need help the discord isnt working
and if you are coding in 3d?
Then you change OnCollisionEnter3D
@@ultimav3868 Shouldn't he change it to OnCollisionEnter ( Collision , collision)?