K
K
KeysCG2020-07-12 21:13:24
C++ / C#
KeysCG, 2020-07-12 21:13:24

How to play sound after Destroy or SetActive(false)?

Good day to all!
Please tell me how can I make the Sound play even after Destroy or SetActive(false).
I made a simple script for selecting a key, but if you just turn it off during selection, then the sound does not have time to play. I found a way to make a delay through IEnumerator, but the key disappears after some time, which is not very beautiful :(
This is how the code looks now (most likely he wrote it very crookedly, since I'm just learning and writing based on what I know):
5f0b51f1e68d9898955626.png
I can not figure out how to make it so that when the key disappears, the sound is played :)
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2020-07-12
@GavriKos

Write a separate sound controller that lives forever

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question