MechaHamster
An open source project by
FPL.
|
Source code for MechaHamster is available for download from Github.
If cloning locally using
git clone
, be sure to use the--recurse-submodules
flag to ensure required scripts from submodules are present.
The MechaHamster project was built using version 2017.2.1p3 of the Unity Editor. Opening it with an older version of the editor may encounter errors.
When you first open MechaHamster in Unity, you will see a large number of errors. MechaHamster depends on several external packages that need to be imported before it can be run.
You will need to download the Firebase Unity SDK, and import the following packages into the Unity project:
Package | File Name |
---|---|
Firebase Analytics | FirebaseAnalytics.unitypackage |
Firebase Auth | FirebaseAuth.unitypackage |
Firebase Crashlytics (Beta) | FirebaseCrashlytics.unitypackage |
Firebase Database | FirebaseDatabase.unitypackage |
Firebase Messaging | FirebaseMessaging.unitypackage |
Firebase Remote Config | FirebaseRemoteConfig.unitypackage |
Firebase Cloud Storage | FirebaseStorage.unitypackage |
MechaHamster currently only works with .NET 3.x. If Firebase Unity SDK version is 5.4.0 or above, please import plugins from
dotnet3
folder. And make sureScripting Runtime Version
inEdit > Project Settings > Player
is set to .NET 3.x, ex.Stable (.NET 3.5 Equivalent)
in Unity 2017
In addition to importing the Firebase Unity SDK packages you'll also need to create a a project in the Firebase Console, and download the files necessary to link it to MechaHamster:
com.google.fpl.mechahamster
for Android and com.google.fpl.mechahamster.dev
for iOS since the former iOS bundle ID was taken)google-services.json
(android) or GoogleService-Info.plist
(iOS). Put this file somewhere in your /Assets
directory. (You can re-download this file again at any time from the Firebase Console.)In order to make use of Firebase Authentication, you will need to calculate a SHA-1 hash from your signing key, and enter it into the Firebase console.
Note: This is only necessary when building for Android devices. You do not need to enter the SHA-1 for iOS builds.
google-services.json
again. You can find the download button in the same page. Then replace the one you stored in your /Assets
directory.MechaHamster requires several capabilities to be enabled in XCode in order to function on iOS devices.
'Push Notifications' requires a paid Apple developer account. More information can be found in Configuring APNs with FCM page. However, the game can still run without it.
Firebase Auth provides several methods by which a user can sign in and access their data. MechaHamster supports several of these, but they must be enabled in the Firebase console before they can be used. (They are all disabled by default.)
MechaHamster depends heavily on the Firebase Realtime Database for storage. In order to run Mechahamster, you'll need set up the database access rules.
/console
directory.database.rules.json
file under /console
directory to your Firebase project, which will be detailed below.MechaHamster can access Firebase Realtime Database in the Unity Editor. Set Database url to your project's database url using the SetEditorDatabaseUrl() function.
/Assets/Hamster/Scripts/MainGame.cs
in the text editor.SetEditorDatabaseUrl
. For instance, google-services.json
(android) or GoogleService-Info.plist
(iOS).MechaHamster requires the Firebase project to be configured in a specific way to run properly. Firebase CLI allows the developers to deploy or update configurations, such as rules and Cloud Functions, to your Firebase project with few console commands.
/console
directory in the project.Functions
when it prompts for Which Firebase CLI features do you want to setup for this folder?
.Enter
until the initialization completes.Replay in MechaHamster is an experimental feature to capture and upload the play-through of the best score in each level so that other player can download and view the animation later. This is still a work in progress and thus disabled by default. To enable it, please follow the instructions below.
/Assets/Hamster/Scripts/MainGame.cs
in the text editor.RemoteConfigGameplayRecordingEnabled
. For instance, true
.