Skip to content

Commit cf3b3f6

Browse files
fixes build
1 parent 719afbc commit cf3b3f6

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
createRelease:
1313
name: Create Release
1414
runs-on: ubuntu-latest
15+
outputs:
16+
upload_url: ${{ steps.createReleaseStep.outputs.upload_url }}
1517
steps:
1618
- name: Create Release
17-
id: createRelease
19+
id: createReleaseStep
1820
uses: actions/create-release@v1
1921
env:
2022
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -27,9 +29,12 @@ jobs:
2729
buildForAllSupportedPlatforms:
2830
name: Build for ${{ matrix.targetPlatform }}
2931
runs-on: ubuntu-latest
32+
needs: createRelease
3033
strategy:
3134
fail-fast: false
3235
matrix:
36+
projectPath:
37+
- Blocktest
3338
targetPlatform:
3439
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
3540
- StandaloneWindows # Build a Windows standalone.
@@ -42,27 +47,30 @@ jobs:
4247

4348
- uses: actions/cache@v2
4449
with:
45-
path: Library
50+
path: ${{ matrix.projectPath }}/Library
4651
key: Library-${{ matrix.targetPlatform }}
4752
restore-keys: Library-
4853

4954
- uses: game-ci/unity-builder@v2
5055
id: build
5156
with:
57+
unityVersion: 2020.2.5f1
58+
projectPath: ${{ matrix.projectPath }}
5259
targetPlatform: ${{ matrix.targetPlatform }}
5360

54-
- uses: actions/upload-artifact@v2
55-
with:
56-
name: Build-${{ matrix.targetPlatform }}
57-
path: build/${{ matrix.targetPlatform }}
61+
- name: Zip build
62+
run: |
63+
pushd build/${{ matrix.targetPlatform }}
64+
zip -r ../../Build-${{ matrix.targetPlatform }}.zip .
65+
popd
5866
5967
- name: Upload Release Asset
6068
id: upload-release-asset
6169
uses: actions/upload-release-asset@v1
6270
env:
6371
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6472
with:
65-
upload_url: ${{ steps.createRelease.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
66-
asset_path: build/${{ matrix.targetPlatform }}
67-
asset_name: Build-${{ matrix.targetPlatform }}
73+
upload_url: ${{ needs.createRelease.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
74+
asset_path: ./Build-${{ matrix.targetPlatform }}.zip
75+
asset_name: Build-${{ matrix.targetPlatform }}.zip
6876
asset_content_type: application/zip

Blocktest/Assets/Scripts/Block System/BlockManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public Block(int id, string myName, Sprite mySprite, AudioClip place, bool doesS
7171
placeSound = place;
7272
blockSmoothing = doesSmooth;
7373
if(doesSmooth) {
74-
spriteSheet = new SpriteSheet(blockSprite.texture);
74+
spriteSheet = new SpriteSheet("Sprites/" + blockSprite.texture.name);
7575
}
7676
}
7777
}

Blocktest/Assets/Scripts/SpriteSheets.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,31 @@
22
using System.Collections.Generic;
33
using UnityEngine;
44
using UnityEditor;
5-
65
[System.Serializable]
76
public class SpriteSheet
87
{
98
public Texture2D Texture;
109

1110
public Dictionary<string, Sprite> spritesDict = new Dictionary<string, Sprite>();
1211

12+
#if UNITY_EDITOR
1313
public SpriteSheet(Texture2D texture)
1414
{
1515
Texture = texture;
16+
1617
string path = AssetDatabase.GetAssetPath(Texture).Replace("Assets/Resources/", null);
1718
Sprite[] sprites = Resources.LoadAll<Sprite>(path.Remove(path.Length - 4));
1819
foreach (Sprite sprite in sprites)
1920
{
2021
spritesDict[sprite.name] = sprite;
2122
}
2223
}
24+
#endif
2325

2426
public SpriteSheet(string texturePath)
2527
{
2628
string path = texturePath.Replace("Assets/Resources/", null);
27-
Sprite[] sprites = Resources.LoadAll<Sprite>(path.Remove(path.Length - 4));
29+
Sprite[] sprites = Resources.LoadAll<Sprite>(path);
2830
foreach (Sprite sprite in sprites)
2931
{
3032
spritesDict[sprite.name] = sprite;

0 commit comments

Comments
 (0)