Forum rules - please read before posting.

Issue on NPC sound

Hi everybody,
AC 1.75.6 and Unity LTS 2021.3.0f1 in 2d.

I have a NPC that sometimes is in scene, sometimes not (depending on a global variable). This NPC has a idle with a sound linked to an event in the first frame of the idle animation (Sprite unity). The idle is a loop so, with event, the sound can play correctly.
So when the NPC is in scene I use Object/Visibility to show him and it's all right. But when he isn't in scene I make him invisible (so as object he's in scene). Now I have the issue because he's invisible but I can hear the sound linked to his idle. I tried to stop the sound but nothing.

Is there a way to make the NPC not visible and disable the sound linked to his idle (and enable when he's in scene)?

Thank you very much.

Comments

  • You should be able to use the Object: Call event Action to disable his AudioSource component, by having it set the enabled property to false.

    In case the audio kicks in with the scene's very first frame, it may be better to disable the AudioSource manually, and instead use the above Action to enable it should he be visible.

  • Hello Chris,
    thank you very much. It seems work correctly.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.