{"id":21585317,"url":"https://github.com/catcodegames/timers","last_synced_at":"2026-02-14T13:03:45.538Z","repository":{"id":261845122,"uuid":"878974358","full_name":"CatCodeGames/Timers","owner":"CatCodeGames","description":"Efficient and precise timers for Unity with integration into PlayerLoop. The timers account for the difference in time between cycles, avoiding cumulative errors, and offer flexible parameter configuration.","archived":false,"fork":false,"pushed_at":"2025-01-17T15:54:44.000Z","size":34,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T16:52:41.466Z","etag":null,"topics":["csharp","playerloop","timers","unity","unity-package"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CatCodeGames.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-10-26T16:09:16.000Z","updated_at":"2025-01-17T15:54:45.000Z","dependencies_parsed_at":"2024-11-08T19:28:06.590Z","dependency_job_id":"2ff37769-c3a8-4d14-9671-01328eb1b424","html_url":"https://github.com/CatCodeGames/Timers","commit_stats":null,"previous_names":["catcodegames/timers"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatCodeGames%2FTimers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatCodeGames%2FTimers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatCodeGames%2FTimers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatCodeGames%2FTimers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CatCodeGames","download_url":"https://codeload.github.com/CatCodeGames/Timers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235459034,"owners_count":18993637,"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","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":["csharp","playerloop","timers","unity","unity-package"],"created_at":"2024-11-24T15:09:52.764Z","updated_at":"2025-01-24T15:25:25.361Z","avatar_url":"https://github.com/CatCodeGames.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 1. Description\nAn efficient and accurate timer for Unity with PlayerLoop integration. The timer accounts for time differences between cycles, avoiding accumulation errors. \nKey features:\n- setting the number of repetitions;\n- selecting the game update cycle (Update, FixedUpdate, or LateUpdate);\n- the ability to consider or ignore time scaling;\n- support for multiple invocations on each timer trigger;\n- safe multiple starting and stopping of the timer within a single update cycle.\n\n# 2. Usage\n### Creation\nTo create a timer object, use the constructor with the following parameters:\n``` csharp\nIntervalTimer timer = new IntervalTimer(interval, callback, updateMode, unscaledTime, loops, multiInvokeOnUpdate)\n```\n- interval: Time in seconds between timer triggers.\n- callback: Method called when the timer triggers.\n- updateMode: Unity update cycle in which the timer will be processed (Update, FixedUpdate, or LateUpdate). Default is Update.\n- unscaledTime: Whether to consider time scaling. Default is false.\n- loops: Number of timer repetitions. Set to -1 for an infinite timer. Default is -1.\n- multiInvokeOnUpdate: Whether to allow multiple callback invocations per update cycle. Default is false.\n\n### Control\n- Start(): Starts the timer.\n- Stop(): Stops the timer.\n\nThe Start and Stop methods can be safely called multiple times for the timer within a single update cycle. The timer correctly handles such multiple calls in one frame.\n\n# 3. Example\n``` csharp\n    private void Awake()\n    {\n        _timer = new IntervalTimer(1f, OnElapsed);\n    }\n\n    private void OnEnable()\n    {\n        _timer.Start();\n    }\n\n    private void OnDisable()\n    {\n        _timer.Stop();\n    }\n\n    private void OnElapsed()\n    {\n        Debug.Log($\"{Time.time}\");\n    }\n```\n\nExample Output\n``` csharp\n    1,003953\n    2,002245\n    3,00188\n    4,004385\n    5,004099\n    ...\n```\n\n\n\n# 1. Описание\nЭффективный и точный таймер для Unity с интеграцией в PlayerLoop. Таймер учитывают разницу времени между циклами, избегая накопления ошибок. \nОсновные возможности:\n- задание количества повторений;\n- выбор игрового цикла обновления (Update, FixedUpdate или LateUpdate);\n- возможность учитывать или игнорировать масштаб времени;\n- поддержка множественных вызовов при каждом срабатывании таймера;\n- безопасный многократный запуск и остановка таймера в пределах одного цикла обновления;\n\n# 2. Использование\n### Создание\nДля создание объекта таймера используется конструктор со следующими параметрами.\n``` csharp\nIntervalTimer timer = new IntervalTimer(interval, callback, updateMode, unscaledTime, loops, multiInvokeOnUpdate)\n```\n- interval: Время в секундах между срабатываниями таймера.\n- callback: Метод, вызываемый при срабатывании таймера.\n- updateMode: В каком цикле обновления Unity будет обрабатываться таймер (Update, FixedUpdate или LateUpdate). По умолчанию - Update\n- unscaledTime: Учитывать ли масштаб времени. По умолчанию - false\n- loops: Количество повторений таймера. Для бесконечного таймера указать параметр -1. По умолчанию -1.\n- multiInvokeOnUpdate: Разрешить ли множественные вызовы callback за один цикл обновления. По умолчанию false.\n\n### Управление\n- Start(): Запуск таймера.\n- Stop(): Остановка таймера.\n\nМетоды Start и Stop могут быть безопасно вызваны несколько раз для таймера в пределах одного цикла обновления. Таймер корректно обрабатывает такие множественные вызовы в одном кадре.\n\n\n# 3. Пример\n``` csharp\n    private void Awake()\n    {\n        _timer = new IntervalTimer(1f, OnElapsed);\n    }\n\n    private void OnEnable()\n    {\n        _timer.Start();\n    }\n\n    private void OnDisable()\n    {\n        _timer.Stop();\n    }\n\n    private void OnElapsed()\n    {\n        Debug.Log($\"{Time.time}\");\n    }\n```\n\nПример вывода\n``` csharp\n    1,003953\n    2,002245\n    3,00188\n    4,004385\n    5,004099\n    ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatcodegames%2Ftimers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatcodegames%2Ftimers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatcodegames%2Ftimers/lists"}