🚀Quickstart
Setup and Run Instructions:
For developers who want a quick step-by-step guide and already know how to set up projects with Firebase:
Preferably use Unity Editor 2022.3.17f1 or newer.
Create a URP project and convert it to Android or IOS.
Install the Unity packages via PackageManager: Input System , AI Navigation, In APP Purchasing, Sprite 2D and TMP Text Pro.
Install the FirebaseFirestore_12.2.0 package or newer.
Install the FirebaseAuth_12.2.0 package or newer.
Install the BulletHell Elemental Template package.
If for some reason the Project Tags/Layers were not imported or you imported the Template into an existing project and chose not to import the Tags: Add Monster Tags to the monsters and bosses in the game, including the monster models from the Demo in BulletHellTemplate > Resources > Monsters and add the maps from the Scenes folder in Build Settings. The maps should be in the sequence Login / Home / other maps.
Set up the Project in the Firebase console, get the file generated at the end with the name google-services.json (without editing this name) and add it to the project in the assets folder.
Go to the Firebase console, set the "Authentication/Login Method" to accept email/password and anonymous login methods.
Set up the Firestore Database by creating a new collection called "Players".
Add a BattlePass collection outside of the Players collection, in the configuration window of this collection in Document ID put the SeasonInfo and just below add 2 fields one will be renamed Season with the type Number and value 1, and another field renamed as StartSeason with type timeStamp with the date and time that the first season begins.
Add the Basic Rules to the Database in the rules tab:
For developers who have not yet set up a project with Firebase or who have any questions, below is a detailed step-by-step guide with images:
-Create a URP Project in the Unity Editor.
-Preferably using Editor 2022.3.17f1
-HDRP and integrated pipeline projects also work to create a game, but the demo textures must be converted or replaced.
-Change the platform to Android or IOS (this requires that you have installed the Android and IOS Modules in the unity editor)
-If you have not installed the modules, go to your UnityHub, click on the installs tab, click on the configuration gear of the editor you will use, click on Add Modules and then you can install the Android Build and its derivatives and IOS build and its derivatives, it is not necessary to add both but the firebase SDK will soon present an IOS or Android error and you will have to disable the "Validate References" of the corresponding dll. -If you have any questions, check the common errors section.
Install the Input System, AI Navigation, In APP Purchasing, Sprite 2D and TextMeshPro packages from PackageManager. Usually the project configuration file will install these dependencies automatically, but to be on the safe side, install them beforehand.
Install FirebaseFirestore_12.2.0 . Install FirebaseAuth_12.2.0 . Install Bullethell Elemental Template. Link: https://developers.google.com/unity/archive . Search for Firebase Authentication and Firebase Cloud Firestore for Firebase.
If you did not import the Tags/Layers and project settings: Add the Monster Tag to the project and apply it to the demo monsters and any monsters you create and add to the project. Add all maps from the Bullet Hell > Resources > Scenes folder The maps should be in the sequence Login / Home / other maps
-Go to your account console on the Firebase website, create a new project and configure it. Remember to copy your project's identification name from Player Settings > Player > Other Settings > Identification > PackageName for Android and iOS to add it to your Firebase project configuration. -Grab the google-services.json file without changing its name, because if this is not the first time, it may be like "google-services.json(2)" for example and you will need to delete this (2) at the end and then place the file in the project's assets folder. -To be safe, create the StreamingAssets folder and place the google-services.json file inside it, because in some cases the Firebase SDK cannot find the file.
Now in the Firebase console, go to Authentication and add Email/Password and Anonymous as login methods. Next, go to the Firestore Database and create a new collection called Players and add an Initial document. Finally, for the Battle Pass to work correctly, add a BattlePass collection outside of the Players collection, in the configuration window of this collection in Document ID put the SeasonInfo and just below add 2 fields one will be renamed Season with the type Number and value 1, and another field renamed as StartSeason with type timeStamp with the date and time that the first season begins. Change the Season value when you want to start a new Season and when the players enter the game the pass will be reset.
In the Cloud Firestore menu, go to the Rules tab, copy and paste the basic security rules and click Publish. This is essential for players to be able to access the database and have the minimum level of security. Currently, the rules prevent disconnected users from accessing the database and allow the application to change only the document and the current user's information, but with free reading of the data so that the Ranking menus can work.
With that, your project should now work, but if you have any issues, please contact us on our discord for support. If you try to create an account using email/password for the first time and get an error message saying unknown error in the login menu, try to see if your password is strong enough for the authentication parameters (I recommend at least 8 characters with letters, numbers and one special character). If the problem persists, try restarting the project
Note: you can add more security options, such as APP Check and other Firebase options. The goal of the Template is to be practical and allow developers to create their games without upfront server expenses. -For experienced developers, there is the possibility of moving the Load and Save logic completely to the server side using Firebase Cloud Functions, but this requires upgrading the Firebase plan and will also greatly increase the number of Reads and Writes on the server, also increasing the final expenses. -In future updates I will implement an additional package that changes the database systems to CloudFunctions with its separate documentation, at no cost to those who already have Asset, just as an alternative for those who prefer to have more security in exchange for a higher server cost.
Last updated