Skip to content

Commit 1d638b9

Browse files
committed
Demo support
1 parent 9978ec1 commit 1d638b9

33 files changed

+4067
-0
lines changed

.github/workflows/main.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Actions 😎
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
name: Build my project ✨
8+
runs-on: ubuntu-latest
9+
steps:
10+
# Checkout
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
with:
14+
lfs: true
15+
16+
# Cache
17+
- uses: actions/cache@v3
18+
with:
19+
path: Library
20+
key: Library-${{ hashFiles('Demo~/Assets/**', 'Demo~/Packages/**', 'Demo~/ProjectSettings/**') }}
21+
restore-keys: |
22+
Library-
23+
24+
# Test
25+
- name: Run tests
26+
uses: game-ci/unity-test-runner@v4
27+
env:
28+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
29+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
30+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
31+
with:
32+
githubToken: ${{ secrets.GITHUB_TOKEN }}
33+
34+
# Build
35+
- name: Build project
36+
uses: game-ci/unity-builder@v4
37+
env:
38+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
39+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
40+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
41+
with:
42+
targetPlatform: WebGL
43+
44+
# Output
45+
- uses: actions/upload-artifact@v3
46+
with:
47+
name: Build
48+
path: build

Demo~/.gitignore

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This .gitignore file should be placed at the root of your Unity project directory
2+
#
3+
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
4+
#
5+
/[Ll]ibrary/
6+
/[Tt]emp/
7+
/[Oo]bj/
8+
/[Bb]uild/
9+
/[Bb]uilds/
10+
/[Ll]ogs/
11+
/[Uu]ser[Ss]ettings/
12+
13+
# MemoryCaptures can get excessive in size.
14+
# They also could contain extremely sensitive data
15+
/[Mm]emoryCaptures/
16+
17+
# Asset meta data should only be ignored when the corresponding asset is also ignored
18+
!/[Aa]ssets/**/*.meta
19+
20+
# Uncomment this line if you wish to ignore the asset store tools plugin
21+
# /[Aa]ssets/AssetStoreTools*
22+
23+
# Autogenerated Jetbrains Rider plugin
24+
/[Aa]ssets/Plugins/Editor/JetBrains*
25+
26+
# System
27+
.DS_Store
28+
29+
# Visual Studio cache directory
30+
.vs/
31+
32+
# Rider cache directory
33+
.idea/
34+
35+
# Gradle cache directory
36+
.gradle/
37+
38+
# Autogenerated VS/MD/Consulo solution and project files
39+
ExportedObj/
40+
.consulo/
41+
*.csproj
42+
*.unityproj
43+
*.sln
44+
*.suo
45+
*.tmp
46+
*.user
47+
*.userprefs
48+
*.pidb
49+
*.booproj
50+
*.svd
51+
*.pdb
52+
*.mdb
53+
*.opendb
54+
*.VC.db
55+
56+
# Unity3D generated meta files
57+
*.pidb.meta
58+
*.pdb.meta
59+
*.mdb.meta
60+
61+
# Unity3D generated file on crash reports
62+
sysinfo.txt
63+
64+
# Builds
65+
*.apk
66+
*.unitypackage
67+
68+
# Crashlytics generated file
69+
crashlytics-build.properties

Demo~/.vscode/settings.json

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"files.exclude":
3+
{
4+
"**/.DS_Store":true,
5+
"**/.git":true,
6+
"**/.gitignore":true,
7+
"**/.gitmodules":true,
8+
"**/*.booproj":true,
9+
"**/*.pidb":true,
10+
"**/*.suo":true,
11+
"**/*.user":true,
12+
"**/*.userprefs":true,
13+
"**/*.unityproj":true,
14+
"**/*.dll":true,
15+
"**/*.exe":true,
16+
"**/*.pdf":true,
17+
"**/*.mid":true,
18+
"**/*.midi":true,
19+
"**/*.wav":true,
20+
"**/*.gif":true,
21+
"**/*.ico":true,
22+
"**/*.jpg":true,
23+
"**/*.jpeg":true,
24+
"**/*.png":true,
25+
"**/*.psd":true,
26+
"**/*.tga":true,
27+
"**/*.tif":true,
28+
"**/*.tiff":true,
29+
"**/*.3ds":true,
30+
"**/*.3DS":true,
31+
"**/*.fbx":true,
32+
"**/*.FBX":true,
33+
"**/*.lxo":true,
34+
"**/*.LXO":true,
35+
"**/*.ma":true,
36+
"**/*.MA":true,
37+
"**/*.obj":true,
38+
"**/*.OBJ":true,
39+
"**/*.asset":true,
40+
"**/*.cubemap":true,
41+
"**/*.flare":true,
42+
"**/*.mat":true,
43+
"**/*.meta":true,
44+
"**/*.prefab":true,
45+
"**/*.unity":true,
46+
"build/":true,
47+
"Build/":true,
48+
"Library/":true,
49+
"library/":true,
50+
"obj/":true,
51+
"Obj/":true,
52+
"ProjectSettings/":true,
53+
"temp/":true,
54+
"Temp/":true
55+
}
56+
}

Demo~/Assets/GameControllers.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
using System.Collections;
2+
using System;
3+
using System.Collections.Generic;
4+
using UnityEngine;
5+
using Backtrace.Unity;
6+
7+
public class BacktraceGameController : MonoBehaviour
8+
{
9+
10+
private const string LastAction = "action.last";
11+
private BacktraceClient _client;
12+
13+
void Start()
14+
{
15+
QualitySettings.vSyncCount = 0;
16+
Application.targetFrameRate = 10;
17+
_client = BacktraceClient.Instance;
18+
}
19+
20+
public void Crash()
21+
{
22+
_client[LastAction] = "Crash";
23+
#if UNITY_EDITOR
24+
Debug.LogError("Crashing the game will crash your Editor. Preventing the crash in the editor mode.");
25+
return;
26+
#endif
27+
28+
Debug.LogWarning("Crashing the game");
29+
UnityEngine.Diagnostics.Utils.ForceCrash(UnityEngine.Diagnostics.ForcedCrashCategory.Abort);
30+
}
31+
32+
33+
public void HandledException()
34+
{
35+
try
36+
{
37+
Debug.LogError("Handled exception action");
38+
ReadFile();
39+
}
40+
catch (Exception e)
41+
{
42+
_client.Send(e);
43+
}
44+
}
45+
46+
public void UnhandledException()
47+
{
48+
Debug.LogWarning("Unhandled exception action");
49+
ReadFile();
50+
}
51+
52+
public void Oom()
53+
{
54+
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
55+
Debug.LogWarning("Starting OOM");
56+
StartCoroutine(StartOom());
57+
#else
58+
Debug.LogError("Action not supported.");
59+
#endif
60+
}
61+
62+
private bool _doOom = true;
63+
private List<Texture2D> _textures = new List<Texture2D>();
64+
private IEnumerator StartOom()
65+
{
66+
while (_doOom)
67+
{
68+
var texture = new Texture2D(512, 512, TextureFormat.ARGB32, true);
69+
texture.Apply();
70+
_textures.Add(texture);
71+
yield return new WaitForSecondsRealtime(0.5f);
72+
}
73+
}
74+
75+
private void FreezeMainThread()
76+
{
77+
const int anrTime = 11000;
78+
System.Threading.Thread.Sleep(anrTime);
79+
}
80+
81+
public void StartAnr()
82+
{
83+
Debug.LogWarning("Starting ANR in the managed Unity thread.");
84+
FreezeMainThread();
85+
}
86+
87+
/// <summary>
88+
/// Use this function to extend stack trace information
89+
/// </summary>
90+
private void ReadFile()
91+
{
92+
ReadNotExistingFileFromTheStorage();
93+
}
94+
95+
private void ReadNotExistingFileFromTheStorage()
96+
{
97+
throw new Exception("ReadNotExistingFileFromTheStorage");
98+
}
99+
100+
}

Demo~/Assets/GameControllers/BacktraceGameController.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo~/Assets/Managers.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo~/Assets/Plugins.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo~/Assets/Scenes.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)