Skip to content

Commit

Permalink
Update Unreal Engine Android Setup (#3034)
Browse files Browse the repository at this point in the history
Co-authored-by: melekr <melekramki@gmail.com>
  • Loading branch information
rick-bt and melekr authored Dec 4, 2024
1 parent e15ff1a commit f0d3a92
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions docs/error-reporting/platform-integrations/unreal/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,7 @@ To configure the crash reporter for a packaged build:

Integrate the [backtrace-android](https://github.com/backtrace-labs/backtrace-android) error reporting library with your Unreal Engine game for Android written in Java or Kotlin.

1. Download [BacktraceAndroid_UPL.xml](https://gist.github.com/ianrice07/36d8731f0d1af10af4803288c7c86c10).
1. In the `BacktraceAndroid_UPL.xml` file, provide the name of your [subdomain and a submission token](/error-reporting/platform-integrations/unreal/setup/#what-youll-need) for `BacktraceCredentials`.
- Java:
```java
BacktraceCredentials credentials = new BacktraceCredentials("https://submit.backtrace.io/{subdomain}/{submission-token}/json");
```
- Kotlin:
```java
val backtraceCredentials = BacktraceCredentials("https://submit.backtrace.io/{subdomain}/{submission-token}/json")
```
1. Download [BacktraceWrapper](https://github.com/backtrace-labs/backtrace-unreal-android/releases) package.
1. In the directory for your Unreal Engine project, locate your app or game's `Build.cs` file.
1. Place the `BacktraceAndroid_UPL.xml` file in the same directory with the `Build.cs` file.
1. In the `Build.cs` file, add the following lines at the end of the `ModuleRules` class constructor:
Expand All @@ -160,23 +151,27 @@ Integrate the [backtrace-android](https://github.com/backtrace-labs/backtrace-an
}
```

1. Download the [BacktraceWrapper.h](https://gist.github.com/lysannep/6c09a572baffede96cd250dbdf01279a#file-backtracewrapper-h) header file and add it to your GameInstance.
1. To initialize the Backtrace client, use `BacktraceIO::FInitializeBacktraceClient`.
:::note
It's recommended to initialize the client from the `GameInstance::OnStart()` method. However, if the method is not available, you can initialize the client with any method you use to start your app or game process.
:::
:::note
Optionally, you can specify custom attributes and file attachment paths to submit with your error reports. If you choose to specify file attachment paths, they must be specified as Android paths. For example, to specify a file attachment path for your `ProjectSavedDir()`, use:
1. Place the `BacktraceWrapper.h` and `BacktraceWrapper.cpp` files in the same directory and add BacktraceWrapper to your GameInstance.
1. To initialize the Backtrace client, use `BacktraceIO::FInitializeBacktraceClient` with the name of your [subdomain and a submission token](/error-reporting/platform-integrations/unreal/setup/#what-youll-need) as a SubmissionUrl.
```cpp
FString SubmissionUrl = TEXT("https://submit.backtrace.io/{subdomain}/{submission-token}/json");
BacktraceIO::FInitializeBacktraceClient(SubmissionUrl, Attributes, Attachments);
```

Check warning on line 159 in docs/error-reporting/platform-integrations/unreal/setup.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/error-reporting/platform-integrations/unreal/setup.md#L159

[sauce.EOLWhitespace] Remove whitespace characters from the end of the line.
Raw output
{"message": "[sauce.EOLWhitespace] Remove whitespace characters from the end of the line.", "location": {"path": "docs/error-reporting/platform-integrations/unreal/setup.md", "range": {"start": {"line": 159, "column": 9}}}, "severity": "WARNING"}

Check warning on line 160 in docs/error-reporting/platform-integrations/unreal/setup.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/error-reporting/platform-integrations/unreal/setup.md#L160

[sauce.EOLWhitespace] Remove whitespace characters from the end of the line.
Raw output
{"message": "[sauce.EOLWhitespace] Remove whitespace characters from the end of the line.", "location": {"path": "docs/error-reporting/platform-integrations/unreal/setup.md", "range": {"start": {"line": 160, "column": 1}}}, "severity": "WARNING"}
>**Note:**
>It's recommended to initialize the client from the `GameInstance::OnStart()` method. However, if the method is not available, you can initialize the client with any method you use to start your app or game process.
>
>Optionally, you can specify custom attributes and file attachment paths to submit with your error reports. If you choose to specify file attachment paths, they must be specified as Android paths. For example, to specify a file attachment path for your `ProjectSavedDir()`, use:
```
if (Target.Platform == UnrealTargetPlatform.Android)
#include "Misc/App.h"
#if PLATFORM_ANDROID
extern FString GFilePathBase;
FString FileAttachmentPath = GFilePathBase + FString("/UE4Game/") + FApp::GetName() + TEXT("/") + FApp::GetName() + TEXT("/Saved") + TEXT("MyFileName.txt");
FString FileName = TEXT("MyFileName.txt");
FilePath = GFilePathBase + FString("/UE5Game/") + FApp::GetName() + TEXT("/") + FApp::GetName() + TEXT("/Saved/") + FileName;
#endif
```
For more details on how to convert your Unreal Engine paths to Android paths, see the conversion functions for `FAndroidPlatformFile::PathToAndroidPaths` in the `AndroidPlatformFile.cpp` file.
:::

To change the default configuration settings for the Backtrace client, you can change the settings in the `BacktraceAndroid_UPL.xml` file. For more information, see [Configuring Backtrace for Android](/error-reporting/platform-integrations/android/configuration/) for the backtrace-android library.

Expand Down

0 comments on commit f0d3a92

Please sign in to comment.