A Beginner’s Guide to Integrating Push Notifications in Unity Projects
This guide will walk you through the process of integrating Unity’s push notification service into your project. The steps are straightforward and easy to follow, making it beginner-friendly.
Before You Start:
Step 1: Set Up Your Unity Project Begin by creating a new Unity project or opening an existing one.
Step 2: Install the Push Notifications Package From the Unity registry’s package manager, install the Push Notifications package.
Step 3: Set Up Your Firebase Project Create a new project on Firebase or open an existing one. Open Firebase Console
Step 4: Enable Authentication in Firebase This step is crucial as the Web API key won’t show up otherwise.
Step 5: Copy and Paste Keys Copy the Project ID, Project Number, Web API Key, and App ID from Firebase Project Settings, and paste them in your Unity project under Project Settings/Services/Push Notifications.
Figures 6, 7, 8: Copying Relevant Values from Firebase Project Settings and Pasting Them in Project Settings/Services/Push Notifications.
Step 6: Generate a New Private Key From the Service Accounts tab in your Firebase app project settings, generate a new private key.
Step 7: Add the Google Key Navigate to Unity Cloud in Push Notifications settings and add the Google key. Open Unity Cloud
Recommended by LinkedIn
Step 8: Create a New Notification Go to the notifications tab and create a new notification. Fill in the details.
Step 9: Import In-Game Debug Console To test notifications instantly, import the In-Game Debug Console and drag the prefab into your scene. Asset Link
Step 10: Make the Build and Copy the Device Token
Step 11: Test on Device In Unity Cloud, click ‘Test on Device’, paste the device token, and hit send. You should receive the notification.
Step 12: Complete the Rest of the Settings Complete the rest of the settings by scheduling the notification.
Congratulations, you have successfully integrated push notifications into your Unity project!
At present, this guide is exclusively for Android. However, I plan to create a version for iOS in the future.
If you encounter any issues or notice any mistakes in this article while following the steps, please leave a comment. I will assist you and make the necessary corrections to enhance this article and make it more beginner-friendly.
Video Tutorial: