-
UE5 Lyra Starter Game - UI (~)Study/UnrealEngine 2023. 5. 3. 14:31
Base
CommonUI plugin 사용
Lyra 에서 다시 한 번 랩핑(?)
Setting
- 게임 모드 > 게임 플레이 경험 설정
해당 게임 모드에 어떤 데이터들이 필요한지 정의
GameMode > Default Gameplay Experience : B_LyraDefaultExperience
B_LyraDefaultExperience --|> ULyraExperienceDefinition --|> UPrimaryDataAsset - B_LyraDefaultExperience > Action Sets : LAS_StandardHUD
LAS_StandardHUD --|> ULyraExperienceActionSet --|> UPrimaryDataAsset
※ Experience > Actions > AddWidgets 로도 똑같은 결과물 가능- Layout - Layout Class : W_ShooterHUDLayout
- Layer ID - GameplayTag : UI.Layer.Game
※ PrimaryAsset 이 추가할 때, 정상 적용이 되지 않고, 경로나 데이터를 찾을 수 없다거나 유효하지 않다는 에러가 발생하면, 파일 디렉터리 경로를 에셋 매니저에 등록했는지 확인할 것!
GameUIManagerSubsystem
GameUIPolicy 관리
- Load : Editor 에서 만든 BP_UIPolicy 를 DefaultUIPolicyClass 로 등록 - DefaultGame.ini
- Notify : GameUIPolicy->NotifyLocalPlayerAdded&Removed&Destoryed
- NotifyLocalPlayerAdded : PrimaryGameLayout -> Create -> AddToViewport
- NotifyPlayerRemoved : PrimaryGameLayout -> Find -> RemoveFromViewport
- NotifyPlayerDestroyed : NotifyPlayerRemoved
GameUIPolicy
- B_LyraUIPolicy > Layout Class : W_OverallUILayout
W_OverallUILayout --|> PrimaryGameLayout
W_OverallUILayout --> ChildLayer(Game_Stack, GameMenu_Stack, Menu_Stack, Modal_Stack)
ChildLayer --|> UCommonActivatableWidgetContainerBase - LyraUIManagerSubsystem > DefaultUIPolicyClass
DefaultGame.ini - DefaultUIPolicyClass=/Game/UI/B_LyraUIPolicy.B_LyraUIPolicy_C - Within = GameUIManagerSubsystem : 생성, 소유 제한
PrimaryGameLayout
- 레이어 정보 등록
PrimaryGameLayout --|> UCommonUserWidget
- TMap<FGameplayTag, TObjectPtr<UCommonActivatableWidgetContainerBase>> Layers;
FGameplayTag : ZOrder +a?
UCommonActivatableWidgetContainerBase : LayerWidget (= Widget list ?)
- UI.Layer.Game : HUD - AHUD 를 말하는게 아님
- UI.Layer.GameMenu : Popup Windows (ex. Inventory, Map ...)
- UI.Layer.Menu : Setting Screen
- UI.Layer.Modal : 사용자 확인이 필요한 창 (ex. Error, 확인창)
UCommonActivatableWidgetContainerBase
- Base of widgets built to manage N activatable widgets, displaying one at a time.
- UCommonActivatableWidgetStack
Only the widget at the top of the stack is displayed and activated. All others are deactivated. - UCommonActivatableWidgetQueue
Only one widget is active/displayed at a time, all others in the queue are deactivated.
FUserWidgetPool
Pools UUserWidget instances to minimize UObject and SWidget allocations for UMG elements with dynamic entries.
동적 항목이 있는 UMG 요소들을 위해 UObject 와 SWidget 할당을 최소화하는 UUserWidget instance 를 담는다.
Note that if underlying Slate instances are released when a UserWidget instance becomes inactive, NativeConstruct & NativeDestruct will be called when UUserWidget instances are made active or inactive, respectively, provided the widget isn't actively referenced in the Slate hierarchy (i.e. if the shared reference count on the widget goes from/to 0).
UserWidget instance 가 비활성화될 때, 하위 Slate instance 가 해제되면, Slate 계층 구조에서 적극적으로 참조되지 않았던 widget 의 경우, UserWidget instance 가 활성화/비활성화될 때, NativeConstruct / NativeDestruct 가 호출될 것이다. (다시 말해, 공유 참조 카운트가 0 에서 0 으로 가면)
WARNING: Be sure to release the pool's Slate widgets within the owning widget's ReleaseSlateResources call to prevent leaking due to circular references Otherwise the cached references to SObjectWidgets will keep the UUserWidgets - and all that they reference - alive
경고! 순환 참조로 인한 누수를 방지하기 위해, 소유하는 위젯의 ReleaseSlateResources 호출 내에서 풀의 슬레이트 위젯을 해제해야 한다. 그렇지 않으면 SObjectWidgets 에 대한 캐시된 참조가 UUserWidgets 및 참조하는 모든 항목을 활성 상태로 유지할 것이다.
- GameExperience > Actions : Add Component
- Within = OuterClassName : 이 클래스의 오브젝트는 OuterClassName 오브젝트의 인스턴스 외부에 존재할 수 없습니다. 즉 이 클래스의 오브젝트를 생성하는 것은 OuterClassName 인스턴스를 Outer 오브젝트로 제공해야 한다는 뜻입니다.
https://docs.unrealengine.com/4.27/ko/ProgrammingAndScripting/GameplayArchitecture/Classes/Specifiers/
클래스 지정자
클래스가 엔진과 에디터의 다양한 부분과 어떻게 작동하는지를 지정하기 위해 UClass 선언시 사용되는 키워드입니다.
docs.unrealengine.com
- UserWidget->AddToViewport() => GameViewportSubsystem->AddWidget()
- CommonUserWidget->AddToPlayerScreen() => GameViewportSubsystem->AddWidgetForPlayer()
'Study > UnrealEngine' 카테고리의 다른 글
UE UBlueprintAsyncActionBase (0) 2023.06.08 UE5 ThirdPerson with Lyra Character (0) 2023.05.04 UE AssetManager (0) 2023.04.21 UE5 Game UI Manager Subsystem (~) (0) 2023.04.21 UE Reflection (0) 2023.04.05 댓글
- 게임 모드 > 게임 플레이 경험 설정