{"id":26552657,"url":"https://github.com/lfeq/improved-game-manager","last_synced_at":"2025-08-17T13:14:59.501Z","repository":{"id":283344975,"uuid":"948200518","full_name":"lfeq/Improved-Game-Manager","owner":"lfeq","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-19T19:20:11.000Z","size":2555,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T19:28:55.311Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"ShaderLab","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lfeq.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-13T23:17:16.000Z","updated_at":"2025-03-19T19:20:14.000Z","dependencies_parsed_at":"2025-03-19T19:38:58.265Z","dependency_job_id":null,"html_url":"https://github.com/lfeq/Improved-Game-Manager","commit_stats":null,"previous_names":["lfeq/improved-game-manager"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lfeq/Improved-Game-Manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfeq%2FImproved-Game-Manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfeq%2FImproved-Game-Manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfeq%2FImproved-Game-Manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfeq%2FImproved-Game-Manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lfeq","download_url":"https://codeload.github.com/lfeq/Improved-Game-Manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfeq%2FImproved-Game-Manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270852224,"owners_count":24656840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-22T08:38:43.988Z","updated_at":"2025-08-17T13:14:59.482Z","avatar_url":"https://github.com/lfeq.png","language":"ShaderLab","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Application Manager\n\nA robust Unity package for efficient game state management using Scriptable Objects and a State Machine pattern.\n\nManaging game states (e.g., Main Menu, Gameplay, Pause, Game Over) usually involves enums and cumbersome switch\nstatements, leading to maintainability issues in large projects. This package simplifies state management by leveraging\nUnity's Scriptable Objects, providing an organized and scalable solution.\n\n### Traditional Approach to Game State Management\n\nDevelopers often manage game states using enums and switch statements, which can become unwieldy as projects grow. A\ntypical implementation might look like this:\n\n```csharp\npublic void ChangeGameState(GameState newState) {\n    if (m_gameState == newState) {\n        return;\n    }\n    m_gameState = newState;\n    switch (m_gameState) {\n        case GameState.None:\n            break;\n        case GameState.LoadMainMenu:\n            LoadMenu();\n            break;\n        case GameState.MainMenu:\n            break;\n        case GameState.LoadLevel:\n            LoadLevel();\n            break;\n        case GameState.Playing:\n            break;\n        case GameState.RestartLevel:\n            RestartLevel();\n            break;\n        case GameState.GameOver:\n            break;\n        case GameState.Credits:\n            break;\n        case GameState.QuitGame:\n            QuitGame();\n            break;\n        default:\n            throw new UnityException(\"Invalid Game State\");\n    }\n}\n```\n\nWhile functional, this approach can lead to large, hard-to-maintain scripts as the number of game states increases. To\naddress this issue, the Application Manager utilizes the State Machine pattern in combination with Unity's Scriptable\nObjects, promoting a more modular and maintainable architecture.\n\n---\n\n## Features\n\n- Easy creation and management of game states and events through Scriptable Objects.\n\n- Built-in support for common states (scene changes, quitting, restarting scenes).\n\n- Extendable architecture for custom game state implementations.\n\n- Debug mode to track state changes effectively.\n\n---\n\n## Installation\n\n1. Open Unity's Package Manager.\n2. Add the required dependency via Git URL: `https://github.com/UnityCommunity/UnitySingleton.git`\n3. Add this package via Git URL: `https://github.com/lfeq/Improved-Game-Manager.git`\n4. Done!\n\n---\n\n## Usage\n\n### Improved Usage\n\n- You can create your new `BaseStates` with the editor window found in `Window/Application Manager/Create State`\n  Here you can create a new state, event and event listener all in one go, just assign the state type, the state name,\n  the path where you want to save your new state and click create. This will generate the `Event`, `EventListener` and\n  `State` for you and put them in separated folders. By default, the path is `Assets/Data/Application States/States`,\n  `Assets/Data/Application States/Application Events` and `Assets/Data/Application States/Application EventListeners`\n  respectively. Just remember to assign the state to transition to in the `EventListener` inspector.\n\n### Basic Usage\n\n1. Create a new State:\n    - Right-click in the Project window → `Application Manager/States/[State]`\n\n![Context Menu](Readme~/ContextMenuExampe.png)\n\n2. Create an EventListener:\n    - Right-click in the Project window → `Application Manager/Application EventListeners/[EventListener]`\n3. Create an Event:\n    - Right-click in the Project window → `Application Manager/Application Events/[Event]`\n4. Link Event and EventListener\n    - Assign the Event to the EventListener's inspector.\n\n![Assign Event](Readme~/AssignEvent.png)\n\n5. Assign EventListener to State:\n    - Assign the Event to the EventListener's inspector.\n\n![Assign EventListener](Readme~/AssignEventListener.png)\n\n6. Assign EventListener to State:\n    - Assign the Event to the EventListener's inspector.\n\n### Custom States\n\nYou can create your custom states by inheriting from the `BaseState` class. This allows you to define custom logic for\nmore complex game states.\n\n```csharp\n[CreateAssetMenu(fileName = \"New Example State\", menuName = MENU_ROOT_NAME + \"Example State\")]\npublic class ExampleState : BaseState {\n     \n  public override void OnEnter() {\n      base.OnEnter();\n      // Add custom logic here\n  }\n\n  public override void OnExit() {\n      base.OnExit();\n      // Add custom logic here\n  }\n}\n```\n\n---\n\n## How It Works\n\nThe Application Manager leverages the State Machine pattern combined with Unity’s Scriptable Objects for flexible state\nmanagement:\n\n- StateMachine: Handles transitioning between different states.\n\n- BaseState: Defines abstract states as Scriptable Objects.\n\n- Events \u0026 EventListeners: Trigger state transitions via UnityEvents.\n\n- ApplicationManager: A singleton managing the current game state.\n\n### Architecture Overview:\n\n- Each State inherits from a base ScriptableObject class.\n\n- Events trigger registered EventListeners when raised.\n\n- EventListeners invoke state transition logic defined by UnityEvents.\n\n- StateMachine manages current states and ensures proper transitions.\n\n### Benefits:\n\n- Clean separation of state logic.\n\n- Easy state creation without modifying existing code.\n\n- Enhanced debugging capabilities.\n\n- Reduction of boilerplate and repetitive code.\n\n![uml](Readme~/UML.png)\n\n---\n\n## Contributing\n\nWe welcome your contributions to improve Application Manager! To contribute:\n\n1. Fork the repository.\n\n2. Create your feature branch (git checkout -b feature/YourFeatureName).\n\n3. Commit your enhancements (git commit -m 'Describe your feature clearly').\n\n4. Push to your branch (git push origin feature/YourFeatureName).\n\n5. Submit a Pull Request detailing your changes.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flfeq%2Fimproved-game-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flfeq%2Fimproved-game-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flfeq%2Fimproved-game-manager/lists"}