2D Unity game for Android
This repository contains an example cross-platform Unity game that integrates the Skillz SDK. It is intended to supplement the documentation that walks users through the process of integrating a cross-platform Unity game.
All credits to the design of this game belongs to Zhouyu Wu.
Original code: https://github.com/zwu002/Unity-Pinball
Use governed by the MIT License.
This project integrated the Skillz SDK version 21.0.25. Check the Downloads page for the latest version.
The project was built on Unity 2018.3.7.
If you are experiencing trouble, please email [email protected] with a detailed description of the issue you are encountering.
The commits in this repository have been organized to make the SDK integration easier to follow.
The first commit makes some preparations before integrating the SDK. Specifically, the UI was altered in anticipation of launching the Skillz SDK, being able to abort a match, and removing soon to be dead code.
The second commit simply installs the Skillz SDK via Unity's Assets store by following the instructions on this page. At this point, the game is not integrated with the SDK and still compiles and runs normally.
Finally, the Skillz SDK is integrated by following the instructions at this page.
Changes in this commit include:
- Adding a
SkillzDelegategame object to the scene that will launch the Skillz SDK. - Modifying the
GameController.csscript to implement theSkillzMatchDelegateinterface. This methods of this interface are called to notify the game when a match is about to begin or end. - Reporting the user's current score while a match is in progress.
- Reporting the user's final score when the match ends.
- Aborting a match.
This commit ensures fairness during a match by calling SkillzCrossPlatform.Random.Range() when setting a ball's initial direction and force. Refer to this page for more details.
This repository also contains exports to both Android and iOS.
This commit has a working Android Studio project that followed the corresponding instructions. The project was set up in Android Studio 3.3, with the game tested on a Google Pixel 2 emulator running Android Oreo.
This commit exported the game as an XCode project that followed the corresponding instructions. The project was set up in XCode 10.1, with the game tested on an iPhone SE running iOS 11.3.
Unlike the Android Studio project, the XCode project here needs some work in order to compile and run on an iOS device.
First, make sure you have the appropriate developer certificate and provisioning profiles to be able to run on an iOS device. The provisioning profiles need to set the bundle name to com.skillz.unity.pinball.
Second, the XCode project is missing the Skillz SDK and some libraries in order to save space on GitHub. You'll need to add these back in order to compile and run the game on iOS. Follow the instructions below to add these back.
- Download the Skillz SDK v21.0.25 for iOS.
- Copy
Skillz.frameworkto<repo_root>//Users/jlin/repos/Unity-Pinball/Platforms/iOS/Skillz Examples Pinball/where<repo_root>is where you cloned this repo. - In XCode, navigate to the project's properties page, and select the
Build Phasestab. - Under the
Embed Frameworksdrop-down, click the `` sign and addSkillz.framework. Make sure the `Code Sign on Copy` option is checked!
These libraries are from Unity, and should reside in /Applications/Unity/PlaybackEngines/iOSSupport/Trampoline/Libraries/.
- In Finder, go to the folder listed above.
- Copy
libiPhone-lib.aandlibil2cpp.ato<repo_root>/Users/jlin/repos/Unity-Pinball/Platforms/iOS/Skillz Examples Pinball/Librarieswhere<repo_root>is where you cloned this repo. - In XCode, navigate to the project's properties page, and select the
Build Phasestab. - Under the
Link Binary With Librariesdrop-down, click the+sign and select the files from Step 2.
At this point, the XCode should compile successfully.