x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Error when trying to toggle active a sound cue.

Hello, I have found that there is an error that pops up whenever I try to toggle whether or not a sound cue is active. I have some screenshots. I'm not exactly sure what's wrong or how to fix this. alt text

Thank you for looking.

Product Version: UE 4.14
Tags:
untitled.png (585.2 kB)
untitleddddd.png (31.6 kB)
more ▼

asked Dec 20 '16 at 12:51 AM in Blueprint Scripting

avatar image

TalkingIsGreat
43 12 14 20

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Before you access the audio component call the "IsValid?" node to make sure it's a valid audio component before you use it. Somewhere you are calling DestroyActor to destroy the audio component and you are maintaining an old reference to the destroyed audio component.

more ▼

answered Dec 20 '16 at 05:34 AM

avatar image

elitereloaded
664 22 19 54

avatar image TalkingIsGreat Dec 20 '16 at 05:39 AM

Does toggling whether or not the spawned audio is active delete the spawned audio?

avatar image elitereloaded Dec 20 '16 at 06:08 AM

Not to my knowledge, it doesn't.

Can you post screenshots of your blueprint code where you are accessing the audio component and assigning a sound to it. If you could also show me the details panel for the audio component in question that would help me reproduce this locally to give you better support.

avatar image TalkingIsGreat Dec 20 '16 at 06:12 AM

I think I already have- untitled.png. Here it is again, anyways.

alt text

untitled.png (585.2 kB)
avatar image elitereloaded Dec 20 '16 at 06:51 AM

Sorry I didn't see the second image embedded in your original post -- my bad.

Are you destroying this MainMenu_Widget when this error occurs?

At which point are you executing this chain of function calls? Is it during the Widget's Construct event or a custom event fired on a button click? When are you calling your StartMusic event?

In order for me to reproduce this I need a clear understanding of how to reproduce your exact design :)

avatar image TalkingIsGreat Dec 20 '16 at 03:04 PM

MainMenu_Widget Never gets destroyed. The sound is spawned when the Main Menu is constructed. The custom event is a button click, that is set in the same widget. Thanks again.

avatar image elitereloaded Dec 20 '16 at 06:17 PM

ok well I think the problem is that your StartMusic event is accessing the return value of SpawnSound2D after the EventConstruct ends. This means the return value of SpawnSound2D won't be available. After you spawn your sound immediately promote it to a private variable within your widget so your other events can use the sound reference.

avatar image elitereloaded Dec 20 '16 at 07:36 PM

There are two problems with your setup.

The first is that you need to store the reference of the spawned sound in a variable in your widget. This will allow other events in your widget to access the spawned instance.

The second issue, which caught me by surprise, is when you call SetActive and set it to false in a Widget blueprint, it does actually destroy the audio component that was created.

Below is a working solution, I was able to reproduce your issue and solved by using the SetVolumeMultiplier node to basically turn off/on the volume of the audio component instead of calling SetActive. I also stored the audio component reference into a class variable.

For the record, calling SetActive and setting it to false does not destroy the audio component when the audio component is added as a component to a PlayerController or any other Actor.

alt text

(comments are locked)
10|2000 characters needed characters left

What worked for me is when spawning/creating the 2D sound, disable "auto destroy", in the drop down menu.

more ▼

answered Jan 10 '19 at 08:58 AM

avatar image

GordoneFreedoge
1

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question