- Home /
This question was
closed Jun 10, 2018 at 12:59 PM by
polan31 for the following reason:
Problem is not reproducible or outdated
How to destroy an object with sound?
I have three objects.
Two squares and one empty.
The Gamer script has been added to the empty object, thanks to which I can destroy the square after clicking on it.
How to destroy an object and hear the sound?
Comment
Best Answer
Answer by polan31 · Jun 10, 2018 at 12:59 PM
I put a solution on the unith forum.
If anyone needs -find my question on the forum :)
Answer by Saryk360 · Jun 01, 2018 at 03:39 PM
You set your gameobject to inactive gameObject.SetActive (false);
in CheckDestroyedIndex()
, which you call just before destroyAS.Play()
; and judging from destroyAS = GetComponent<AudioSource>()
your AudioSource
is attached to gameobject
.
I still don't catch it, because the sound is when you press the first object.