분류 전체보기151 UnrealEngine 리플렉션 https://www.youtube.com/watch?v=VpEe9DbcZIs&t=9s이 글은 해당 영상을 정리한 글입니다. UObject언리얼 엔진에서 제공하는 클래스들은 베이스 클래스로 UObject를 상속받아 생성됨 리플렉션리플렉션런타임중 객체의 유형이나 속성을 볼 수 있게 해주는 기능리플렉션이 필요한 이유다른 모듈에 정의된 사용자 클래스 객체들도 엔진 내의 시스템이 관리해야 함컴파일 타임에는 해당 클래스들을 알 수 없음 그래서 런타임 리플렉션이 필요리플렉션 지정 일반 C++클래스들은 해당 매크로들을 지정하지 못함 언리얼 C++의 클래스와 구조체 차이 C++에선 클래스와 구조체의 차이점이 없지만 언리얼 C++에선 위 표와같이 차이점이 있음 언리얼 헤더 툴작성한 코드들은 언리얼 헤더 툴에 의해 먼저.. 2025. 3. 31. Project_P Damage UI 제작(4) 플레이어 컨트롤러에서 UI 생성 플레이어 컨트롤러에서 UI 생성APPPlayerController.hclass PROJECT_P_API APPPlayerController : public APlayerController{ GENERATED_BODY() public: APPPlayerController();//Damage UI Sectionpublic: void ActorTakedDamage(const float& Damage, const FVector& ActorPosition);protected: UPROPERTY(EditAnywhere, Category = "HUD") TSubclassOf DamageUIClass; UPROPERTY(VisibleAnywhere, Category = "HUD") TArray> DamageUIArra.. 2025. 3. 27. Project_P Damage UI 제작(3) UI 블루프린트 생성 C++로 생성한 DamageUI 블루프린트로 생성 콘텐츠 브라우저에서 우클릭 → 유저 인터페이스 → 위젯 블루프린트 클릭C++에서 생성한 클래스를 부모로 블루프린트 클래스 생성 UI 구성은 간단하게 SizeBox 안에 텍스트 블럭을 넣음텍스트 블럭의 이름은 반드시 C++ 클래스에서 생성한 변수 이름과 똑같아야 됨 블루프린트 에디터 밑에 애니메이션을 클릭하여 애니메이션을 생성 및 설정애니메이션도 텍스트와 마찬가지로 C++에서 생성한 변수와 이름이 같아야됨 2025. 3. 27. Project_P Damage UI 제작(2) Damage UI 생성 UUserWidget을 상속받아 Damage UI 생성DamageUI.hclass PROJECT_P_API UPPFloatingTextUserWidget : public UUserWidget{ GENERATED_BODY()public: UPPFloatingTextUserWidget(const FObjectInitializer& ObjectInitializer); virtual void NativeConstruct() override;public: bool SetTextWidget(const float& Damage, const FVector& ActorPosition); FEndLifeTime EndLifeTime; FWidgetAnimationDynamicEvent AnimFinishedDelegate.. 2025. 3. 27. Project_P Damage UI 제작(1) 로직 구성 기존 IPPGameInterface 에 함수 추가IPPGameInterface.hclass PROJECT_P_API IPPGameInterface{ GENERATED_BODY() // Add interface functions to this class. This is the class that will be inherited to implement this interface.public: virtual void OnPlayerDead() = 0; virtual void OnTakeDamage(const float& Damage, const FVector& ActorPosition) = 0;};Damage UI 도 데미지를 받으면 게임모드를 통해 PlayerController에서 UI를 생성함그래서 Ga.. 2025. 3. 26. Project_P AI Perception 팀설정 AI Perception 팀설정하기기존에 AI Perception을 이용해 몬스터의 시야기능을 구현 했었다.그 당시에는 팀설정이 안되어 있어서 적, 아군, 중립 탐지 설정을 전부 true로 설정을 했었다최근에 캐릭터 액터에 팀을 설정하는 법을 알게되어 적용해 보았다. IGenericTeamAgentInterface 인터페이스 상속APPCharacterBase.h#include "GenericTeamAgentInterface.h"UCLASS()class PROJECT_P_API APPCharacterBase : public ACharacter, public IGenericTeamAgentInterface{ GENERATED_BODY()//GenericTeam Sectionpublic: virtual voi.. 2025. 3. 25. Project_P 재시작 UI 제작 UUserWidget을 상속받아 GameOverUserWidget 클래스 생성 헤더파일UCLASS()class PROJECT_P_API UPPGameOverUserWidget : public UUserWidget{ GENERATED_BODY() public: UPPGameOverUserWidget(const FObjectInitializer& ObjectInitializer);protected: virtual void NativeConstruct() override; UFUNCTION(BlueprintCallable, Meta = (DisplayName = "BtnEventGameRestartCpp")) void BtnEventGameRestart();protected: UPROPERTY(meta = (.. 2025. 2. 10. Project_P 캐릭터 사망시 UI 출력 및 재시작 함수 흐름도 게임모드를 간접참조하기 위한 인터페이스 생성 캐릭터 클래스에서 캐릭터가 죽을때 호출되는 SetDead()함수가 호출된다SetDead 함수에서 게임을 관리하는 게임모드를 통해 PlayerController 에게 재시작 UI를 띄우라고 함수를 실행한다이 과정에서 캐릭터에서 상위 레이어인 게임모드를 직접 참조하기 보다 인터페이스를 이용하여 간접참조를 한다 IPPGameInterfaceclass PROJECT_P_API IPPGameInterface{ GENERATED_BODY() // Add interface functions to this class. This is the class that will be inherited to implement this interface.public: v.. 2025. 2. 7. UnrealEnigne Cpp에서 Level 재시작 Cpp에서 레벨 재시작 Cpp에서 레벨을 재시작 하는 방법은 크게 ConsolCommand를 이용하는 것과 UGameplayStatics를 이용하는 2가지가 있다. ConsolCommand 콘솔 커맨드를 Cpp에서 실행시키는 법은 월드로부터 명령어를 실행하는 GetWorld()->Exec 함수와 플레이어 컨트롤러에서 실행하는 OwingPlayerController->ConsoleCommand 가 있다. GetWorld()->Exec(GetWorld(), TEXT("RestartLevel"));OwingPlayerController->ConsoleCommand(TEXT("RestartLevel")); GetWorld()->Exec 함수의 경우 커맨드가 실행되지 않는다(이유는 잘모르겠다) OwingPlay.. 2025. 2. 7. 이전 1 2 3 4 5 6 ··· 17 다음