LoginSignup
10
6

More than 3 years have passed since last update.

[UE4] バグ追跡情報の出力コマンド

Last updated at Posted at 2019-12-12

1. 概要

バグ追跡のための情報を出力するためのコンソールコマンドを紹介します。
使い方はコマンドの入力バー(コンソール)を出して"BugItと入力するだけです。

2. コマンド

BugIt
ログ情報(Viewport座標、現在のマップ名、時間、バージョン等)、Slateを含んだスクリーンショット(.png)を出力することができます。

[ファイル出力先]
[PROJECT]/Saved/BugIt/の直下となります。
2019-11-29_17h52_15.png

[ログ出力例]
2019-11-29_17h55_07.png

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. まとめ

このコンソールコマンドを利用すると問題箇所の特定や調査をするのに役立ちます。
これらをうまく活用してデバッグを効率的に行いましょう。

10
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
6