[UE5/C++] Niagara (+Particle)

지우야·2024년 6월 3일
0

팜라이프

목록 보기
2/2

⭐ 개요

몰랐는데 한 번도 C++로 나이아가라를 사용해본적 없었다
그래서 작성하는 나이아가라 사용법~ (파티클과 다를 바가 없다)

이거 참고함 >> 링크텍스트

⭐ 방법

  1. 빌드 파일에 'Niagara'를 추가한다.
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara" });
  1. 헤더 파일을 추가한다.
#include "NiagaraFunctionLibrary.h"
#include "NiagaraComponent.h"
  1. 코드
UNiagaraSystem* NiagaraSystem = LoadObject<UNiagaraSystem>(nullptr, TEXT("Path"));
UNiagaraComponent* NiagaraComponent = UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), NiagaraSystem, GetActorLocation(), GetActorRotation());
	}

⭐ 번외 : 파티클

  1. 헤더 파일 추가
#include "Particles/ParticleSystem.h"
  1. 코드
UParticleSystem* ParticleSystem = LoadObject<UParticleSystem>(nullptr, TEXT("/Game/JIU/Effects/P_Sparks_E.P_Sparks_E"));
ParticleComponent = UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), UParticleSystemComponent* ParticleSystem, GetActorLocation(), GetActorRotation());

다음부턴 헷갈리지 말자!

0개의 댓글