{"id":23980988,"url":"https://github.com/rimurudev/unity-waitforsecondscache","last_synced_at":"2026-02-15T16:03:32.049Z","repository":{"id":270672220,"uuid":"911121768","full_name":"RimuruDev/Unity-WaitForSecondsCache","owner":"RimuruDev","description":"This project introduces a caching system for WaitForSeconds in Unity to optimize the creation of identical timers and a debug view for monitoring cached timers in the Unity Editor.","archived":false,"fork":false,"pushed_at":"2025-01-23T16:52:33.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-04T02:56:22.292Z","etag":null,"topics":["coroutines","rimuru-dev","rimurudev","unity","unity-coroutines","unity-utilities","waitforseconds"],"latest_commit_sha":null,"homepage":"","language":"C#","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/RimuruDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-01-02T09:44:38.000Z","updated_at":"2025-01-23T18:08:50.000Z","dependencies_parsed_at":"2025-01-02T10:21:57.618Z","dependency_job_id":"ae38dd80-1082-42f6-8ac5-2eacc29a4d81","html_url":"https://github.com/RimuruDev/Unity-WaitForSecondsCache","commit_stats":null,"previous_names":["rimurudev/unity-waitforsecondscache"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/RimuruDev/Unity-WaitForSecondsCache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RimuruDev%2FUnity-WaitForSecondsCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RimuruDev%2FUnity-WaitForSecondsCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RimuruDev%2FUnity-WaitForSecondsCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RimuruDev%2FUnity-WaitForSecondsCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RimuruDev","download_url":"https://codeload.github.com/RimuruDev/Unity-WaitForSecondsCache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RimuruDev%2FUnity-WaitForSecondsCache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29483321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T15:33:17.885Z","status":"ssl_error","status_checked_at":"2026-02-15T15:32:53.698Z","response_time":118,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["coroutines","rimuru-dev","rimurudev","unity","unity-coroutines","unity-utilities","waitforseconds"],"created_at":"2025-01-07T10:20:21.274Z","updated_at":"2026-02-15T16:03:32.013Z","avatar_url":"https://github.com/RimuruDev.png","language":"C#","readme":"# WaitForSecondsCache and WaitForSecondsDebugView Documentation\n\nThis project introduces a caching system for `WaitForSeconds` in Unity to optimize the creation of identical timers and a debug view for monitoring cached timers in the Unity Editor.\n\n---\n\n## Table of Contents\n1. [Overview](#overview)\n2. [Features](#features)\n3. [Usage](#usage)\n4. [Debug View](#debug-view)\n5. [Dependencies](#dependencies)\n6. [Integration](#integration)\n7. [Contributions](#contributions)\n\n---\n\n## Overview\n\nThe `WaitForSecondsCache` class provides a simple and efficient caching mechanism for `WaitForSeconds` objects. This reduces memory allocation overhead and improves performance, especially in projects where timers with identical durations are used frequently.\n\nThe `WaitForSecondsDebugView` is a utility designed to help developers monitor and debug cached timers during development.\n\n---\n\n## Features\n\n- **Efficient caching**: Avoids redundant creation of `WaitForSeconds` objects.\n- **Debugging support**: View and monitor cached timers in the Unity Editor.\n- **Singleton design**: The `WaitForSecondsDebugView` leverages a `MonoSingleton` implementation for centralized management.\n- **Editor-only Debugging**: The debug view is included only when the project is running in the Unity Editor.\n\n---\n\n## Usage\n\n### Caching Timers\n\nTo retrieve or cache a `WaitForSeconds` object:\n```csharp\nWaitForSeconds wait = WaitForSecondsCache.Get(0.5f);\nyield return wait;\n```\n\n### Resetting the Cache\n\nTo clear all cached timers:\n```csharp\nWaitForSecondsCache.Reset();\n```\n\n### Accessing the Cache Directly\n\nTo get a read-only view of the current cache:\n```csharp\nvar cache = WaitForSecondsCache.GetCache();\nforeach (var entry in cache)\n{\n    Debug.Log($\"Time: {entry.Key}, WaitForSeconds: {entry.Value}\");\n}\n```\n\n---\n\n## Debug View\n\nThe `WaitForSecondsDebugView` provides a GUI for monitoring cached timers in the Unity Editor. \n\n### Features\n- Displays all currently cached `WaitForSeconds` objects.\n- Allows enabling/disabling the debug view via an Inspector toggle.\n\n### GUI Example\n\nThe debug view appears in the top-left corner of the game view when running in the Editor:\n```\nWaitForSeconds Cache Debug View:\nTime: 0.5 seconds\nTime: 1.0 seconds\nTime: 2.0 seconds\n```\n\n### Enable/Disable Debugging\n\nYou can enable or disable the debug view using the `enableDebugView` checkbox in the `WaitForSecondsDebugView` component.\n\n---\n\n## Dependencies\n\n- **MonoSingleton**: The `WaitForSecondsDebugView` relies on a generic MonoSingleton implementation, which can be found [here](https://github.com/RimuruDev/MonoSingleton.git).\n\nTo integrate the MonoSingleton, ensure the following class is available in your project:\n```csharp\nnamespace AbyssMoth.Internal.Codebase.Runtime._MainMenuModule.User\n{\n    public abstract class MonoSingleton\u003cTComponent\u003e : MonoBehaviour where TComponent : Component\n    {\n        // Implementation here (already included in the project).\n    }\n}\n```\n\n---\n\n## Integration\n\n1. Add the `WaitForSecondsCache` and `WaitForSecondsDebugView` classes to your project.\n2. Ensure the `MonoSingleton` implementation is present in your codebase.\n3. Add the `WaitForSecondsDebugView` to a GameObject in your scene or let it auto-instantiate.\n\n---\n\n## Contributions\n\nContributions are welcome! If you find a bug or have a suggestion, feel free to open an issue or a pull request.\n\nFor questions, contact me:\n- **Email**: rimuru.dev@gmail.com\n- **LinkedIn**: [Rimuru's Profile](https://www.linkedin.com/in/rimuru/)\n- **GitHub**: [Rimuru's GitHub](https://github.com/RimuruDev)\n\n---\n\n**License**: Open Source, available under the MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frimurudev%2Funity-waitforsecondscache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frimurudev%2Funity-waitforsecondscache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frimurudev%2Funity-waitforsecondscache/lists"}