Skip to content

Tool support use firebase remote config for game unity

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

wolf-org/remote-config-manager-unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Made With Unity License Last Commit Repo Size Last Release

What

  • Tool support use firebase remote config for game unity

How To Install

Add the line below to Packages/manifest.json

for version 1.0.2

"com.wolf-org.remote-config":"https://github.com/wolf-org/remote-config-manager-unity.git#1.0.2",

dependency extensions-unity-1.0.5

"com.wolf-org.extensions":"https://github.com/wolf-org/extensions-unity.git#1.0.5",

If you use game-data-unity, add the library below and define symbol VIRTUESKY_DATA

"com.wolf-org.game-data":"https://github.com/wolf-org/game-data-unity.git#1.0.2",

Use

  • Add Define symbol to use remote config (VIRTUESKY_FIREBASE, VIRTUESKY_FIREBASE_REMOTECONFIG)

  • Attach FirebaseRemoteConfigManager to scene (don't destroy). Please add a Remote Config Data to the list, then enter the key, select the corresponding data type (int, bool, string), enter the default value. Finally, click Generate Remote Data when you have finished setup.

Screenshot 2024-05-17 112334

  • After clicking Generate Remote Data, the RemoteData.cs script will be automatically generated and formatted as below.
namespace VirtueSky.RemoteConfigs
{
	public struct RemoteData
	{
		public const string KEY_RMC_LEVEL_TURN_ON_INTER_ADS = "RMC_LEVEL_TURN_ON_INTER_ADS";
		public const int DEFAULT_RMC_LEVEL_TURN_ON_INTER_ADS = 5;
		public static int RMC_LEVEL_TURN_ON_INTER_ADS => VirtueSky.DataStorage.GameData.Get(KEY_RMC_LEVEL_TURN_ON_INTER_ADS, DEFAULT_RMC_LEVEL_TURN_ON_INTER_ADS);
		public const string KEY_RMC_INTER_CAPPING_LEVEL = "RMC_INTER_CAPPING_LEVEL";
		public const int DEFAULT_RMC_INTER_CAPPING_LEVEL = 2;
		public static int RMC_INTER_CAPPING_LEVEL => VirtueSky.DataStorage.GameData.Get(KEY_RMC_INTER_CAPPING_LEVEL, DEFAULT_RMC_INTER_CAPPING_LEVEL);
		public const string KEY_RMC_INTER_CAPPING_TIME = "RMC_INTER_CAPPING_TIME";
		public const int DEFAULT_RMC_INTER_CAPPING_TIME = 8;
		public static int RMC_INTER_CAPPING_TIME => VirtueSky.DataStorage.GameData.Get(KEY_RMC_INTER_CAPPING_TIME, DEFAULT_RMC_INTER_CAPPING_TIME);
		public const string KEY_RMC_ON_OFF_INTER = "RMC_ON_OFF_INTER";
		public const bool DEFAULT_RMC_ON_OFF_INTER = true;
		public static bool RMC_ON_OFF_INTER => VirtueSky.DataStorage.GameData.Get(KEY_RMC_ON_OFF_INTER, DEFAULT_RMC_ON_OFF_INTER);
		public const string KEY_RMC_ON_OFF_BANNER = "RMC_ON_OFF_BANNER";
		public const bool DEFAULT_RMC_ON_OFF_BANNER = true;
		public static bool RMC_ON_OFF_BANNER => VirtueSky.DataStorage.GameData.Get(KEY_RMC_ON_OFF_BANNER, DEFAULT_RMC_ON_OFF_BANNER);
		public const string KEY_RMC_LEVEL_SHOW_RATE_AND_REVIEW = "RMC_LEVEL_SHOW_RATE_AND_REVIEW";
		public const int DEFAULT_RMC_LEVEL_SHOW_RATE_AND_REVIEW = 3;
		public static int RMC_LEVEL_SHOW_RATE_AND_REVIEW => VirtueSky.DataStorage.GameData.Get(KEY_RMC_LEVEL_SHOW_RATE_AND_REVIEW, DEFAULT_RMC_LEVEL_SHOW_RATE_AND_REVIEW);
		public const string KEY_RMC_ON_OFF_RATE_AND_REVIEW = "RMC_ON_OFF_RATE_AND_REVIEW";
		public const bool DEFAULT_RMC_ON_OFF_RATE_AND_REVIEW = true;
		public static bool RMC_ON_OFF_RATE_AND_REVIEW => VirtueSky.DataStorage.GameData.Get(KEY_RMC_ON_OFF_RATE_AND_REVIEW, DEFAULT_RMC_ON_OFF_RATE_AND_REVIEW);
		public const string KEY_RMC_VERSION_UPDATE = "RMC_VERSION_UPDATE";
		public const string DEFAULT_RMC_VERSION_UPDATE = "1.0";
		public static string RMC_VERSION_UPDATE => VirtueSky.DataStorage.GameData.Get(KEY_RMC_VERSION_UPDATE, DEFAULT_RMC_VERSION_UPDATE);
		public const string KEY_RMC_CONTENT_UPDATE = "RMC_CONTENT_UPDATE";
		public const string DEFAULT_RMC_CONTENT_UPDATE = "Update Content";
		public static string RMC_CONTENT_UPDATE => VirtueSky.DataStorage.GameData.Get(KEY_RMC_CONTENT_UPDATE, DEFAULT_RMC_CONTENT_UPDATE);
	}
}
  • Handle

From the RemoteData script, you can retrieve key data, default values, and data fetched from firebase remote configuration.

Example

    void HandleBannerAds()
    {
        if (RemoteData.RMC_ON_OFF_BANNER)
        {
            // show banner ads
        }
    }