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"

Audio does not play on spawn

My ball actor has an UAudioComponent, which should play when the ball gets spawned. It also hasa particle system that should start playing at the same time.

 void ABall::OnConstruction(const FTransform& Transform)
 {
     Super::OnConstruction(Transform);
     this->ParticleSystem["P_BallIn"]->ActivateSystem();
     this->Audio["BallIn"]->Play();
 }

The particle system starts playing just fine, however, the audio is not playing at all. This is peculiar, because the audio does play in other non-spawning methods just fine. That means that there's nothing wrong with the audio file, and it does get loaded correctly in PostInitializeComponents. I tried Activate() instead of Play() as well, but that did not solve the problem.

Product Version: Not Selected
Tags:
more ▼

asked Sep 28 '14 at 03:23 PM in C++ Programming

avatar image

Shammah
380 23 18 144

avatar image Shadowriver Sep 28 '14 at 03:38 PM

You can also use PlaySoundAtLocation() which does not require audio component

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AActor/PlaySoundAtLocation/index.html

avatar image Shammah Sep 28 '14 at 03:42 PM

I already tried that as well, no sound gets played. If I place it somewhere else, it works fine.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Did you try play on BeginPlay()?

more ▼

answered Sep 28 '14 at 03:31 PM

avatar image

Shadowriver
37.8k 937 172 1123

avatar image Shammah Sep 28 '14 at 03:46 PM

Ah, that did the trick. I expected it to work with this event as well. Feel free to add this as an answer so I can accept it :)

avatar image Shadowriver Sep 28 '14 at 07:29 PM

Ok converted to answer then :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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