diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f312858..0e51e85 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,9 +12,11 @@ jobs: createRelease: name: Create Release runs-on: ubuntu-latest + outputs: + upload_url: ${{ steps.createReleaseStep.outputs.upload_url }} steps: - name: Create Release - id: createRelease + id: createReleaseStep uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -27,9 +29,12 @@ jobs: buildForAllSupportedPlatforms: name: Build for ${{ matrix.targetPlatform }} runs-on: ubuntu-latest + needs: createRelease strategy: fail-fast: false matrix: + projectPath: + - Blocktest targetPlatform: - StandaloneOSX # Build a macOS standalone (Intel 64-bit). - StandaloneWindows # Build a Windows standalone. @@ -42,19 +47,22 @@ jobs: - uses: actions/cache@v2 with: - path: Library + path: ${{ matrix.projectPath }}/Library key: Library-${{ matrix.targetPlatform }} restore-keys: Library- - uses: game-ci/unity-builder@v2 id: build with: + unityVersion: 2020.2.5f1 + projectPath: ${{ matrix.projectPath }} targetPlatform: ${{ matrix.targetPlatform }} - - uses: actions/upload-artifact@v2 - with: - name: Build-${{ matrix.targetPlatform }} - path: build/${{ matrix.targetPlatform }} + - name: Zip build + run: | + pushd build/${{ matrix.targetPlatform }} + zip -r ../../Build-${{ matrix.targetPlatform }}.zip . + popd - name: Upload Release Asset id: upload-release-asset @@ -62,7 +70,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - 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 - asset_path: build/${{ matrix.targetPlatform }} - asset_name: Build-${{ matrix.targetPlatform }} + 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 + asset_path: ./Build-${{ matrix.targetPlatform }}.zip + asset_name: Build-${{ matrix.targetPlatform }}.zip asset_content_type: application/zip diff --git a/Blocktest/Assets/Scripts/Block System/BlockManager.cs b/Blocktest/Assets/Scripts/Block System/BlockManager.cs index 18a9900..3502bf9 100644 --- a/Blocktest/Assets/Scripts/Block System/BlockManager.cs +++ b/Blocktest/Assets/Scripts/Block System/BlockManager.cs @@ -71,7 +71,7 @@ public Block(int id, string myName, Sprite mySprite, AudioClip place, bool doesS placeSound = place; blockSmoothing = doesSmooth; if(doesSmooth) { - spriteSheet = new SpriteSheet(blockSprite.texture); + spriteSheet = new SpriteSheet("Sprites/" + blockSprite.texture.name); } } } diff --git a/Blocktest/Assets/Scripts/SpriteSheets.cs b/Blocktest/Assets/Scripts/SpriteSheets.cs index 3c33c34..296d69b 100644 --- a/Blocktest/Assets/Scripts/SpriteSheets.cs +++ b/Blocktest/Assets/Scripts/SpriteSheets.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using UnityEngine; using UnityEditor; - [System.Serializable] public class SpriteSheet { @@ -10,9 +9,11 @@ public class SpriteSheet public Dictionary spritesDict = new Dictionary(); +#if UNITY_EDITOR public SpriteSheet(Texture2D texture) { Texture = texture; + string path = AssetDatabase.GetAssetPath(Texture).Replace("Assets/Resources/", null); Sprite[] sprites = Resources.LoadAll(path.Remove(path.Length - 4)); foreach (Sprite sprite in sprites) @@ -20,11 +21,12 @@ public SpriteSheet(Texture2D texture) spritesDict[sprite.name] = sprite; } } +#endif public SpriteSheet(string texturePath) { string path = texturePath.Replace("Assets/Resources/", null); - Sprite[] sprites = Resources.LoadAll(path.Remove(path.Length - 4)); + Sprite[] sprites = Resources.LoadAll(path); foreach (Sprite sprite in sprites) { spritesDict[sprite.name] = sprite;