언리얼 엔진/C++
[언리얼엔진] C++ 에디터 툴바 버튼으로 에디터 유틸리티 위젯 블루프린트 열기
mane
2023. 12. 18. 16:54
728x90
반응형
목표
- 언리얼엔진 C++ 코드를 이용해서 에디터 툴바 버튼을 이용한 에디터 유틸리티 위젯 블루프린트 열기
방법
- C++ 코드로 만들어진 에디터 툴바 버튼의 클릭 이벤트 함수 내에 구현한다.
- Path 는 에디터상에 있는 에디터 위젯 블루프린트의 레퍼런스 주소를 넣어준다.
코드
const FString Path(TEXT("Reference Path"));
if(UObject* Blueprint = UEditorAssetLibrary::LoadAsset(Path); IsValid(Blueprint)) {
if (UEditorUtilityWidgetBlueprint* EditorWidget = Cast<UEditorUtilityWidgetBlueprint>(Blueprint); IsValid(EditorWidget))
{
UEditorUtilitySubsystem* EditorUtilitySubsystem = GEditor->GetEditorSubsystem<UEditorUtilitySubsystem>();
EditorUtilitySubsystem->SpawnAndRegisterTab(EditorWidget);
}
}
728x90
반응형