Skip to content

Commit

Permalink
Generate manually a game and add SDK to it
Browse files Browse the repository at this point in the history
  • Loading branch information
konraddysput committed Feb 2, 2024
1 parent ce7a4d9 commit a053007
Show file tree
Hide file tree
Showing 36 changed files with 4,045 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ jobs:
with:
lfs: true

- name: set a correct package path
- name: create a game by using demo project
run: |
pwd
folderName=$(echo "${PWD##*/}")
rsync -r "$GITHUB_WORKSPACE" "${{ matrix.projectPath }}"
ls -F "${{ matrix.projectPath }}/$folderName"
mkdir ${{ matrix.projectPath }}
cp -r ./Demo~/* ${{ matrix.projectPath }}
rm ./${{ matrix.projectPath }}/Assets/Plugins/backtrace-unity
mkdir ./${{ matrix.projectPath }}/Assets/Plugins/backtrace-unity
mv ./Android ./Editor ./iOS ./Runtime ./Tests ./Windows ./package.json ./${{ matrix.projectPath }}/Assets/Plugins/backtrace-unity
ls ./
find ./${{ matrix.projectPath }}/Assets/Plugins/backtrace-unity
- uses: game-ci/unity-test-runner@v4
id: tests
Expand All @@ -35,7 +39,6 @@ jobs:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
packageMode: true
projectPath: ./${{ matrix.projectPath }}/backtrace-unity
unityVersion: ${{ matrix.unityVersion }}
testMode: ${{ matrix.testMode }}
Expand Down
69 changes: 69 additions & 0 deletions Demo~/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*

# System
.DS_Store

# Visual Studio cache directory
.vs/

# Rider cache directory
.idea/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

# Crashlytics generated file
crashlytics-build.properties
56 changes: 56 additions & 0 deletions Demo~/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"files.exclude":
{
"**/.DS_Store":true,
"**/.git":true,
"**/.gitignore":true,
"**/.gitmodules":true,
"**/*.booproj":true,
"**/*.pidb":true,
"**/*.suo":true,
"**/*.user":true,
"**/*.userprefs":true,
"**/*.unityproj":true,
"**/*.dll":true,
"**/*.exe":true,
"**/*.pdf":true,
"**/*.mid":true,
"**/*.midi":true,
"**/*.wav":true,
"**/*.gif":true,
"**/*.ico":true,
"**/*.jpg":true,
"**/*.jpeg":true,
"**/*.png":true,
"**/*.psd":true,
"**/*.tga":true,
"**/*.tif":true,
"**/*.tiff":true,
"**/*.3ds":true,
"**/*.3DS":true,
"**/*.fbx":true,
"**/*.FBX":true,
"**/*.lxo":true,
"**/*.LXO":true,
"**/*.ma":true,
"**/*.MA":true,
"**/*.obj":true,
"**/*.OBJ":true,
"**/*.asset":true,
"**/*.cubemap":true,
"**/*.flare":true,
"**/*.mat":true,
"**/*.meta":true,
"**/*.prefab":true,
"**/*.unity":true,
"build/":true,
"Build/":true,
"Library/":true,
"library/":true,
"obj/":true,
"Obj/":true,
"ProjectSettings/":true,
"temp/":true,
"Temp/":true
}
}
8 changes: 8 additions & 0 deletions Demo~/Assets/GameControllers.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 100 additions & 0 deletions Demo~/Assets/GameControllers/BacktraceGameController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
using Backtrace.Unity;

public class BacktraceGameController : MonoBehaviour
{

private const string LastAction = "action.last";
private BacktraceClient _client;

void Start()
{
QualitySettings.vSyncCount = 0;
Application.targetFrameRate = 10;
_client = BacktraceClient.Instance;
}

public void Crash()
{
_client[LastAction] = "Crash";
#if UNITY_EDITOR
Debug.LogError("Crashing the game will crash your Editor. Preventing the crash in the editor mode.");
return;
#endif

Debug.LogWarning("Crashing the game");
UnityEngine.Diagnostics.Utils.ForceCrash(UnityEngine.Diagnostics.ForcedCrashCategory.Abort);
}


public void HandledException()
{
try
{
Debug.LogError("Handled exception action");
ReadFile();
}
catch (Exception e)
{
_client.Send(e);
}
}

public void UnhandledException()
{
Debug.LogWarning("Unhandled exception action");
ReadFile();
}

public void Oom()
{
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
Debug.LogWarning("Starting OOM");
StartCoroutine(StartOom());
#else
Debug.LogError("Action not supported.");
#endif
}

private bool _doOom = true;
private List<Texture2D> _textures = new List<Texture2D>();
private IEnumerator StartOom()
{
while (_doOom)
{
var texture = new Texture2D(512, 512, TextureFormat.ARGB32, true);
texture.Apply();
_textures.Add(texture);
yield return new WaitForSecondsRealtime(0.5f);
}
}

private void FreezeMainThread()
{
const int anrTime = 11000;
System.Threading.Thread.Sleep(anrTime);
}

public void StartAnr()
{
Debug.LogWarning("Starting ANR in the managed Unity thread.");
FreezeMainThread();
}

/// <summary>
/// Use this function to extend stack trace information
/// </summary>
private void ReadFile()
{
ReadNotExistingFileFromTheStorage();
}

private void ReadNotExistingFileFromTheStorage()
{
throw new Exception("ReadNotExistingFileFromTheStorage");
}

}
11 changes: 11 additions & 0 deletions Demo~/Assets/GameControllers/BacktraceGameController.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Demo~/Assets/Managers.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Demo~/Assets/Plugins.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Demo~/Assets/Plugins/GameControllers.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Demo~/Assets/Plugins/backtrace-unity
8 changes: 8 additions & 0 deletions Demo~/Assets/Plugins/backtrace-unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Demo~/Assets/Scenes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a053007

Please sign in to comment.