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"

Assigning SoundCue defined in C++ in blueprint property

I've added

  PROPERTY( EditDefaultsOnly, Category = Audio ) 
  TSubclassOf<USoundCue> sound;

to my blueprint class. I'm attempting to assign a SoundCue which I've created in the editor but nothing is showing up when attempting to assign it via the blueprint in the drop down menu. I've done a fair amount of research and cannot see any reason why it shouldn't, this works with any other 'U' class type.

Product Version: Not Selected
Tags:
more ▼

asked May 04 '16 at 08:34 PM in Using UE4

avatar image

UraniumSlug
11 5 8 9

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

2 answers: sort voted first

Changing

 PROPERTY( EditDefaultsOnly, Category = Audio ) 
 TSubclassOf<USoundCue> sound;

to

 PROPERTY( EditDefaultsOnly, Category = Audio ) 
 USoundCue* sound;

solved this.

more ▼

answered May 05 '16 at 05:27 PM

avatar image

UraniumSlug
11 5 8 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
 UPROPERTY(EditDefaultsOnly, Category=Damage)
 TSubclassOf<UDamageType> DamageType;

Is the proper way to declare it. Not sure if you missed that or not.

But you could always try this:

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

Docs for AudioComponent: AudioComponent

more ▼

answered May 04 '16 at 08:50 PM

avatar image

VictorBurgos
2.4k 61 27 113

avatar image UraniumSlug May 05 '16 at 09:26 AM

I've edited my original question, the formatting didn't come out correctly. I'm aware of how to declare UPROPERTY types.

The variable appears in the editor as it should as a USoundCue in the blueprint, but I'm unable to assign any Sound Cue which exist in my project to it. This is odd because I've assigned many other instances of other classes via blueprint before and have never run into issues of the files not being found in editor.

Before I can use PlaySound2D I need an actual USoundBase to pass into the function. This is where I'm getting stuck because I'm unable to assign an existing Sound Cue in editor to my exposed variable in blueprint.

(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