#1. 概要
バグ追跡のための情報を出力するためのコンソールコマンドを紹介します。
使い方はコマンドの入力バー(コンソール)を出して**"BugIt**と入力するだけです。
#2. コマンド
BugIt
ログ情報(Viewport座標、現在のマップ名、時間、バージョン等)、Slateを含んだスクリーンショット(.png)を出力することができます。
[ファイル出力先]
[PROJECT]/Saved/BugIt/の直下となります。
#3. 実装
実装はCheatManager.cppの以下の箇所で定義されています。
CheatManager.cpp
void UCheatManager::BugIt( const FString& ScreenShotDescription )
{
APlayerController* const MyPlayerController = GetOuterAPlayerController();
// Path will be <gamename>/bugit/<platform>/desc/desc_ (BugItDir() includes a platform and trailing slash)
const FString BaseFile = FString::Printf(TEXT("%s%s/%s_"), *FPaths::BugItDir(), *ScreenShotDescription, *ScreenShotDescription);
FString ScreenShotFile;
// find the next filename in the sequence, e.g <gamename>/bugit/<platform>/desc_00000.png
FFileHelper::GenerateNextBitmapFilename(BaseFile, TEXT("png"), ScreenShotFile);
// request a screenshot to that path
MyPlayerController->ConsoleCommand( FString::Printf(TEXT("BUGSCREENSHOTWITHHUDINFO %s"), *ScreenShotFile));
FVector ViewLocation;
FRotator ViewRotation;
MyPlayerController->GetPlayerViewPoint( ViewLocation, ViewRotation );
if( MyPlayerController->GetPawn() != NULL )
{
ViewLocation = MyPlayerController->GetPawn()->GetActorLocation();
}
FString GoString, LocString;
BugItStringCreator( ViewLocation, ViewRotation, GoString, LocString );
// Log bugit data to a textfile with the same name as the screenshot
LogOutBugItGoToLogFile( ScreenShotDescription, ScreenShotFile, GoString, LocString );
}
#4. まとめ
このコンソールコマンドを利用すると問題箇所の特定や調査をするのに役立ちます。
これらをうまく活用してデバッグを効率的に行いましょう。