Unreal Engine C++ Developer: Learn C++ and Make Video Games | Udemy UE4.25 Simple Shooterで自分なりに理解したこと。00200 ~ParticleSystemスポーン~

勉強したこと

Gun.hで

/// Indicates that this property can be edited by property windows in the editor        EditAnywhere,

/////このプロパティがエディタのプロパティウィンドウで編集できることを示します

スポーンするものはポインタで。

	UPROPERTY(EditAnyWhere)
	UParticleSystem* MuzzleFlash;

Gun.cppで

//簡単な方法

static UParticleSystemComponent* SpawnEmitterAttached(class UParticleSystem* EmitterTemplate, class USceneComponent* AttachToComponent, FName AttachPointName = NAME_None);


// Backwards compatible version of SpawnEmitterAttached for C++ without Scale   
//スケールなしのC ++用のSpawnEmitterAttachedの下位互換バージョン
//デフォルト引数がなくて多く使いずらいもの

static UParticleSystemComponent* SpawnEmitterAttached(class UParticleSystem* EmitterTemplate, class USceneComponent* AttachToComponent, FName AttachPointName, FVector Location, FRotator Rotation, EAttachLocation::Type LocationType);

#include "Kismet/GameplayStatics.h"
UGameplayStatics::SpawnEmitterAttached(MuzzleFlash, Mesh, TEXT("MuzzleFlashSocket"));

そしたらエディタでエミッタを設定する

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です