MOBILE ECOSYSTEM MANAGER

Version: 1.0.0 | Contributor: Mathew | Dependencies: Unity 2022.3+

1. Overview

The Platform Ecosystem Manager is a fully decoupled, event-driven architecture designed to handle Google Play Games Services and Apple GameCenter.

Instead of hardcoding platform APIs into gameplay scripts, this package uses a Central Event Bus. Your game logic simply "shouts" that an event happened (e.g., a boss died), and the Ecosystem Manager quietly listens in the background, translates that event into the correct string ID, and awards the achievement or leaderboard score.


1.1 Key Features v1.1.0

  • Zero Dependency Hell: Gameplay scripts do not require references to Google or Apple namespaces.
  • No-Code Configuration: Map platform string IDs using a clean ScriptableObject UI.
  • Smart Offline Caching: Automatically saves un-submitted high scores locally and flushes them when the internet returns.
  • MiniDevTools Integration: Native integration with DataManager.

2. Installation & Setup

  1. Drag the MiniDevTools.EcosystemManager folder into your Unity project's Assets folder.
  2. Unity will automatically compile the package via the included MiniDevTools.EcosystemManager.Runtime.asmdef file.
  3. In your initial startup scene, create an empty GameObject and name it [EcosystemManager].
  4. Attach the EcosystemManager.cs script to this GameObject.

3. Configuration (The ScriptableObject)

💡 Pro Tip: You do not need to edit code to add platform string IDs (e.g., CgkI_12345 for Google or com.studio.ach1 for Apple). Just map them in the Inspector!
  1. In your Project window, right-click and navigate to Create > Ecosystem > Configuration.
  2. Name the generated asset MainEcosystemConfig.
  3. Select the asset. In the Inspector, you will see lists for Achievements and Leaderboards.
  4. Click + to add an entry. Select the human-readable Enum name, and paste the specific Android and iOS string IDs provided by the Google Play Console and App Store Connect.
  5. Finally, drag this MainEcosystemConfig asset into the empty slot on your EcosystemManager component in the scene.

4. Gameplay Integration

Your gameplay scripts should never reference the EcosystemManager directly. Instead, invoke actions through the static GameEvents hub.

4.1 Unlocking a Standard Achievement

Whenever a milestone is reached in your game, invoke the corresponding event:

using MiniDevTools.EcosystemManager; // Add this to the top of your script

public class BossScript : MonoBehaviour
{
    public void OnBossDefeated()
    {
        // 1. Play your game logic (particles, loot, etc.)
        
        // 2. Shout to the Ecosystem
        GameEvents.OnBossPhaseSurvived?.Invoke(1);
    }
}

4.2 Submitting a Leaderboard Score

When a run ends, pass the final time (or score) to the event bus: C#

using MiniDevTools.EcosystemManager;

public class PlayerDeath : MonoBehaviour
{
    public void EndRun(long totalSecondsSurvived)
    {
        // The Ecosystem will automatically catch this and submit it to the active platform
        GameEvents.OnRunCompletedTime?.Invoke(totalSecondsSurvived);
    }
}

5. Adding New Achievements or Leaderboards

When your game expands, you will need to add new milestones.

  1. Open AchievementName.cs or LeaderboardName.cs located in the Enums folder.

  2. Add your new readable name to the list:

public enum AchievementName 
{
    DriverUnlocked,
    BossPhase1Survived,
    Score1Million,
    TheCompletionist,
    FlawlessVictory // <-- New entry added here
}
  1. Open your MainEcosystemConfig ScriptableObject in the Unity Inspector and map the new FlawlessVictory enum to its platform IDs.

  2. Add the routing logic inside EcosystemManager.cs to listen for the specific game event and unlock the achievement.


6. Offline Caching & MiniDevTools

This package includes an OfflineScoreCache. If a player finishes a run without internet access, their score is saved locally.

🔗 Integration with DataManager:

If the MINIDEVTOOLS_DATAMANAGER scripting define symbol is active in your project (which happens automatically when you run the MiniDevTools Setup), the Ecosystem Manager will bypass standard PlayerPrefs and route all offline caches directly into your custom JSON DataManager storage under the tag EcosystemCache.

⚠️ Fallback Notice:

If MiniDevTools is not present in the project, the system safely falls back to standard Unity PlayerPrefs to ensure no data is lost.