UAudioComponent starts playing on SetSound()

When I create a UAudioComponent in my actor’s constructor and call SetSound() to give it the sound, it automatically starts playing. Even calling Stop() directly does not prevent the sounds from playing. As a result, when I start my game, all sounds start playing at the same time; destroying my ears. When spawning multiple clients (multiplayer) they even play for all clients and (dedicated) server.

Have you checked whether bAutoActivate is set on the UAudioComponent? This is the default state for audio components and if you call Stop before it’s tried to activate the sound then that won’t do anything. I wouldn’t advise setting the sound in an actor’s constructor, a better place would probably be PostInitializeComponents. SetSound itself should not directly try to call Play unless the component is already playing.

I have the same issue with blueprints. All sounds are playing once when starting the level. The sounds are in class blueprints, which are scattered as actors in the level.

Got it. Don’t load the sounds as variables in the constructor. With AddAudioComponent works fine…The answer was there. Apologies.