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"

Soundcue not playing?

No sound happens when I fire? I also tried to apply a sound for my health pickup and ammo pickup but can't seem to get them to work either. What I am doing wrong?

My .cpp file

 AWeapon::AWeapon(const FObjectInitializer& projectileVar)
              : Super(projectileVar)
          {
              
              AudioComp = CreateDefaultSubobject<UAudioComponent>(TEXT("AudioComp"));
              AudioComp->AttachParent = RootComponent;
              AudioComp->bAutoActivate = false; 
              AudioComp->bAutoDestroy = false;
          }
      
      void AWeapon::Fire()
      {
              if (LazerGun)
                      {
                          AudioComp->SetSound(LazerGun);
                          AudioComp->Play();
                      }
      }

.h file

  UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Sound")
          UAudioComponent* AudioComp; 
  
   UPROPERTY(EditDefaultsOnly, Category = "Sound")
          USoundCue* LazerGun;


Product Version: UE 4.9
Tags:
more ▼

asked May 02 '16 at 08:31 PM in C++ Programming

avatar image

Mentossss
1 1 4 4

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

3 answers: sort voted first

Make sure to set your sound as LazerGun in your weapon blueprint... facepalm

more ▼

answered May 02 '16 at 10:03 PM

avatar image

Mentossss
1 1 4 4

avatar image VictorBurgos May 02 '16 at 10:07 PM

... heh, good job!

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

Have you tried this?:

  • UGameplayStatics::PlaySound2D(UObject* WorldContextObject, class USoundBase* Sound, float VolumeMultiplier, float PitchMultiplier, float StartTime)

more ▼

answered May 02 '16 at 08:38 PM

avatar image

VictorBurgos
2.4k 60 27 111

avatar image Mentossss May 02 '16 at 08:42 PM

Don't know how to set that up so no. If you would like to show, I may try it. But would like to get my way to work.

avatar image VictorBurgos May 02 '16 at 08:53 PM

I just showed you exactly how to set it up... how much experience do you have in C++ ?

avatar image Mentossss May 02 '16 at 08:57 PM

Not a great deal, still learning. And haven't really used UGameplayStatics much.

avatar image VictorBurgos May 02 '16 at 09:00 PM

Then start learning the way everyone else is doing it. Obviously there are multiple ways of doing it, but my solution is easiest (well, that's subjective also I suppose).

  • If I have answered your question, please upvote and mark it answered to close this report.

  • Good luck!

avatar image Mentossss May 02 '16 at 09:02 PM

Not really answered but thanks.

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

Between those two docs, you should be able to do anything with sounds. Good luck!

more ▼

answered May 02 '16 at 09:13 PM

avatar image

VictorBurgos
2.4k 60 27 111

(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