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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Using SoundCue in actor class?

I would like to access a SoundCue in one of my actor classes. I have an Actor class which contains a UAudioComponent member. The AudioComponent member is assigned a SoundCue class using AudioComponent::SetSound(). I set which SoundCue to use from the UE4 editor. THe AudioComponent member is then exposed through a blueprint method. I call Play() on it from my Blueprint. Only problem is I get no sound. Maybe it's my BluePrint? Or is this doomed to fail from the onset?!

alt text

My Actor header contains the following:

 UPROPERTY(EditAnywhere, Category = "Sound")
 USoundCue* SoundCue;

 UAudioComponent* audioComponent;

 UFUNCTION(BlueprintCallable, Category = "Sound")
 UAudioComponent* getAudioComponent()
     audioComponent->Sound = SoundCue;
     return audioComponent;

I've checked the validity of the AudioComponent, and the SoundCue, and they are both valid. Any ideas?

Product Version: UE 4.10
untitled.png (70.6 kB)
more ▼

asked Jun 19 '16 at 04:51 PM in C++ Programming

avatar image

8 1 4

avatar image rorywalsh Jun 19 '16 at 07:54 PM

I guess I can just call UGameplayStatics::PlaySound2D or something like that. I thought it might be better to expose the AudioComponent but perhaps this is cleaner.

avatar image UPO33 Jun 20 '16 at 07:36 AM

how did u create audio component ?

avatar image rorywalsh Jun 20 '16 at 10:14 AM

Using NewObject<>().

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

0 answers: sort voted first
Be the first one to answer this question
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