# UAudioComponent-\>SetSound() crashing editor

**URL:** <https://forums.unrealengine.com/t/uaudiocomponent-setsound-crashing-editor/301665>\
**Category:** C++\
**Tags:** unreal-engine, CPP, question\
**Created:** [December 15, 2014, 2:48pm UTC](https://forums.unrealengine.com/t/uaudiocomponent-setsound-crashing-editor/301665 "2014-12-15T14:48:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![honaj](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@honaj](https://forums.unrealengine.com/u/honaj)\
**Post date:** [December 15, 2014, 2:48pm UTC](https://forums.unrealengine.com/t/uaudiocomponent-setsound-crashing-editor/301665/1 "2014-12-15T14:48:42Z")

</div>

The editor tells me “Access violation - code c0000005(first/second chance not available)”, but I’m not getting any errors in VS. It doesn’t matter if I use a USoundWave or USoundCue.

Header:

```
UAudioComponent* KickAudioComp;

```

Constructor:

```
static ConstructorHelpers::FObjectFinder<USoundWave>Kick(TEXT("SoundWave'/Game/Audio/Kick3.Kick3'"));

KickAudioComp->SetSound(Kick.Object);
```

---

<div class="post-metadata">

**Author:** ![honaj](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@honaj](https://forums.unrealengine.com/u/honaj)\
**Post date:** [December 19, 2014, 9:29am UTC](https://forums.unrealengine.com/t/uaudiocomponent-setsound-crashing-editor/301665/2 "2014-12-19T09:29:35Z")

</div>

Anyone? I can’t figure out if this is a bug or if I’m doing something wrong.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_957a4452](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_957a4452](https://forums.unrealengine.com/u/anonymous_user_957a4452)\
**Post date:** [December 19, 2014, 11:05am UTC](https://forums.unrealengine.com/t/uaudiocomponent-setsound-crashing-editor/301665/3 "2014-12-19T11:05:00Z")

</div>

Hello,

Make sure you create component and attach it. Try this

```
KickAudioComp = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("AudioTest"));
KickAudioComp->AttachParent = GetMesh();

```

Best regards,
