|
6 | 6 |
|
7 | 7 | # Basics
|
8 | 8 |
|
9 |
| -## Machine Setup |
| 9 | +## Quick Start |
10 | 10 |
|
11 | 11 | ### Install Unity
|
12 | 12 |
|
13 |
| -We recommend using [Unity Hub](https://unity3d.com/get-unity/download). The specific version to download can be found [here](https://github.com/getsentry/sentry-unity/blob/main/samples/unity-of-bugs/ProjectSettings/ProjectVersion.txt#L1). |
14 |
| - |
15 |
| -You'll need the following modules to be added in order to use Sentry Unity: |
16 |
| - * Android Build Support. |
17 |
| - * iOS Build Support. |
18 |
| - * IL2CPP Build Support for your platform. |
19 |
| - * (optional) WebGL Build Support |
| 13 | +1. Install [Unity Hub](https://unity3d.com/get-unity/download). |
| 14 | +2. [Optional] Download the Unity version specified [here](https://github.com/getsentry/sentry-unity/blob/main/samples/unity-of-bugs/ProjectSettings/ProjectVersion.txt#L1). |
| 15 | +3. Required modules: |
| 16 | + * Android Build Support |
| 17 | + * iOS Build Support |
| 18 | + * IL2CPP Build Support for your platform |
| 19 | + * (optional) WebGL Build Support |
| 20 | +4. If you installed a different version than #3: Add that version as `UNITY_VERSION` to the path (i.e. `export UNITY_VERSION=2022.3.44f1`) |
20 | 21 |
|
21 | 22 | ### Install PowerShell Global tool
|
22 | 23 |
|
23 | 24 | ```
|
24 | 25 | dotnet tool install --global PowerShell
|
25 | 26 | ```
|
26 | 27 |
|
| 28 | +### Install GitHub CLI |
| 29 | + |
| 30 | +You can either download the newest release of [here](https://github.com/cli/cli/releases), or if you're on macOS use `brew install gh`. You'll need to log in through the commandline. |
| 31 | + |
| 32 | +## Get the code |
| 33 | + |
| 34 | +Clone the repo `git clone https://github.com/getsentry/sentry-unity.git` and `cd` into it |
| 35 | + |
| 36 | +## Download the Native SDKs |
| 37 | + |
| 38 | +You can save some time on the initial build by downloading the prebuild Native SDK artifacts from the last successful build of the `main` branch (requires [GH CLI](https://cli.github.com/) to be installed locally). |
| 39 | + |
| 40 | +`dotnet msbuild /t:DownloadNativeSDKs src/Sentry.Unity` |
| 41 | + |
| 42 | +## Build the project |
| 43 | + |
| 44 | +[Optional] The build process tries to infer the Unity version by looking up the unity-of-bugs `ProjectVersion.txt`. If you've got a different version installed you can overwrite this behaviour by setting the `UNITY_VERSION` on the path, i.e. adding `export UNITY_VERSION=2022.3.44f1` to your `.zshenv`. |
| 45 | + |
| 46 | +To build the whole project (including native SDKs if you've skipped the previous step), run: |
| 47 | + |
| 48 | +`dotnet build` |
| 49 | + |
| 50 | +> Several projects are used as submodules - [sentry-dotnet](https://github.com/getsentry/sentry-dotnet), [Ben.Demystifier](https://github.com/benaadams/Ben.Demystifier) |
| 51 | +> The submodule will be restored as a result of `dotnet build`. |
| 52 | +
|
| 53 | +## Advanced Setup |
| 54 | + |
| 55 | +This section details the setup required to be able to build the individual Native SDKs. |
| 56 | + |
27 | 57 | ### Setup for building the Java SDK
|
28 | 58 |
|
29 | 59 | * Install Git and ensure is accessible from the PATH
|
@@ -57,55 +87,24 @@ Sentry Native is a sub module from Sentry Unity and for building it, currently r
|
57 | 87 | * Install [CMake](https://cmake.org/download/).
|
58 | 88 | * A supported C/C++ compiler.
|
59 | 89 |
|
60 |
| -## Get the code |
61 |
| - |
62 |
| -Clone the repo `git clone https://github.com/getsentry/sentry-unity.git` and `cd` into it |
63 |
| - |
64 |
| -## Build the project |
65 |
| - |
66 |
| -[Optional] You can save some time on the initial build by downloading the prebuild Native SDK artifacts from the last successful build of the `main` branch (requires [GH CLI](https://cli.github.com/) to be installed locally). |
67 |
| - |
68 |
| -`dotnet msbuild /t:DownloadNativeSDKs src/Sentry.Unity` |
69 |
| - |
70 |
| -To build the whole project (including native SDKs if you've skipped the previous step), run: |
71 |
| - |
72 |
| -`dotnet build` |
73 |
| - |
74 |
| -> Several projects are used as submodules - [sentry-dotnet](https://github.com/getsentry/sentry-dotnet), [Ben.Demystifier](https://github.com/benaadams/Ben.Demystifier) |
75 |
| -> The submodule will be restored as a result of `dotnet build`. |
76 |
| -> The Unity editor is also loaded via the build if needed to restore any UPM package required by the project, like testing libraries. |
77 |
| -
|
78 | 90 | ### Run tests
|
79 | 91 |
|
80 | 92 | ```sh
|
81 | 93 | dotnet msbuild /t:"UnityPlayModeTest;UnityEditModeTest" /p:Configuration=Release test/Sentry.Unity.Tests
|
82 | 94 | ```
|
83 | 95 |
|
84 |
| -### Smoke test by building and running a player with IL2CPP: |
| 96 | +### Running CI integration tests locally |
85 | 97 |
|
86 |
| -```sh |
87 |
| - dotnet msbuild /t:"Build;UnityBuildStandalonePlayerIL2CPP;UnitySmokeTestStandalonePlayerIL2CPP" test/Sentry.Unity.Tests |
| 98 | +CI makes use of a handful of scripts for creating, exporting, building and smoke-testing builds for desktop and mobile platforms. We've added a script to make use of that functionality to emulate (and debug) our integration tests locally. |
| 99 | + |
| 100 | +```pwsh |
| 101 | + pwsh ./test/Scripts.Integration.Test/integration-test.ps1 -Platform "Android-Export" -UnityVersion "6000" |
88 | 102 | ```
|
89 | 103 |
|
90 |
| -After this you can open your IDE (i.e: Visual Studio or Rider) and Unity Editor for development. |
| 104 | +Please refer to the script to make use of any optional parameters. |
91 | 105 |
|
92 | 106 | # Advanced and Troubleshooting
|
93 | 107 |
|
94 |
| -## Finding the Unity installation |
95 |
| - |
96 |
| -The `UnityPath` in `src/Directory.Build.targets` does a lookup at different locations to find Unity. |
97 |
| -This is different per operating system. The repository is configured for Windows and macOS. You can adjust it as needed: |
98 |
| - |
99 |
| -```xml |
100 |
| -<Project> |
101 |
| - <!-- Other properties & groups --> |
102 |
| - <PropertyGroup> |
103 |
| - <UnityPath Condition="<YOUR_PATH_CONDITION>">YOUR_PATH</UnityPath> |
104 |
| - </PropertyGroup> |
105 |
| -</Project> |
106 |
| -``` |
107 |
| -> There is a configuration in place already. Just make sure it works for you or reconfigure for your needs. |
108 |
| -
|
109 | 108 | ## Project Structure
|
110 | 109 |
|
111 | 110 | There are two projects involved in `sentry-unity` development. `UPM` package (`src` and `package-dev` folders) and `Unity` project (`samples/unity-of-bugs` folder, `BugFarmScene.unity`) to test the package in.
|
|
0 commit comments