[언리얼] Cpp - 사운드

gest·2026년 1월 7일

unreal

목록 보기
8/11

이번 게시물에서는 사운드 재생에 관련된 기능을 활용할 계획이다.


라이브러리

#include "Kismet/GameplayStatics.h" //getCharacter, sound

코드


//.h
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Audio")
USoundBase* AttackSound; //사운드 관련, 나는 MS를 사용했다.

//.cpp
if (AttackSound)
{
	UGameplayStatics::PlaySoundAtLocation(
		this,  // WorldContextObject
		AttackSound,
		start,
		1.0f,  // VolumeMultiplier
		1.0f   // PitchMultiplier
	);
}

0개의 댓글