{"id":28104996,"url":"https://github.com/madeyellow/inputbuffer","last_synced_at":"2025-05-13T21:19:30.458Z","repository":{"id":224930074,"uuid":"583639416","full_name":"madeyellow/InputBuffer","owner":"madeyellow","description":"Input buffering  for Unity","archived":false,"fork":false,"pushed_at":"2025-01-14T16:13:39.000Z","size":22,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T17:13:26.950Z","etag":null,"topics":["input","input-buffer","input-buffering","unity"],"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/madeyellow.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}},"created_at":"2022-12-30T12:11:57.000Z","updated_at":"2025-01-14T16:14:12.000Z","dependencies_parsed_at":"2024-02-28T13:44:33.888Z","dependency_job_id":null,"html_url":"https://github.com/madeyellow/InputBuffer","commit_stats":null,"previous_names":["madeyellow/inputbuffer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeyellow%2FInputBuffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeyellow%2FInputBuffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeyellow%2FInputBuffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeyellow%2FInputBuffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madeyellow","download_url":"https://codeload.github.com/madeyellow/InputBuffer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254029025,"owners_count":22002285,"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":["input","input-buffer","input-buffering","unity"],"created_at":"2025-05-13T21:19:06.401Z","updated_at":"2025-05-13T21:19:30.445Z","avatar_url":"https://github.com/madeyellow.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is it?\nSimple yet effective package that buffers (aka remember) some input with 4 lines of code. Check if buffer isn't expired at any given moment, configure buffer's lifetime, cache input values, etc.\n\n## Where and why I should use it?\n\nIt's a perfect solution for buffering action input, such as pressing a jump button. If your player pressed it while not being grounded (e.g. right before landing) your logic may fail and player won't execute jump. *Frustrating, right?*\n\n## Getting started\n\nFirst of all declare input buffer:\n\n```csharp\nusing MadeYellow.InputBuffer;\n\n\npublic SimpleInputBuffer jumpInputBuffer = new SimpleInputBuffer(); // Init input buffer\n```\n\nYou may configure buffer **hold time** from Unity Editor by changing `holdTime` slider OR by passing `holdTime` argument to `InputBuffer` constructor.\n\nYou can choose between various types of `InputBuffer`:\n\n* **SimpleInputBuffer** - best for buffering button presses *(in terms of Unity's InputSystem)*;\n* **IntInputBuffer**, **FloatInputBuffer** - best for buffering axis 1D input *(in terms of Unity's InputSystem)*;\n* **Vector2InputBuffer** - best for buffering gamepad stick input or any other 2D input;\n\nAfter you've set up suitable `InputBuffer` you should use `.Set();` or `.Set(value);` method each time you want to buffer your input. You may do it like so:\n\n```csharp\njumpInputBuffer.Set(); // Set input buffer when input happened\n```\n\nWhen you need to check if certain input is buffered or not you can perform a simple check:\n\n```csharp\nif (jumpInputBuffer.hasBuffer)\n{\n  jumpInputBuffer.Reset(); // Reset buffer since we most likely want to perform action required by input only once\n\n  // Your code goes here, e.g. perform Jump action if input was buffered, etc.\n}\n```\n\n**TIP:** It's best to perform those checks each frame in `Update()` or `LateUpdate()` method inside your MonoBehaviour, so you won't miss any input. It's super cheap in terms of performance.\n\n## How to install Trackable to my Unity project?\n\nUse the Unity Package Manager (in Unity’s top menu: **Window \u003e Package Manager**), click \"+\" icon, select **\"Add package from git URL\"** and type URL of this repository.\n\n## Get buffered value\n\nIf you created `InputBuffer` of any type **except** of `SimpleInputBuffer` (*because it doesn't stores any value, only the fact of the input*) you can call `.value` to retrieve current value of input.\n\n```csharp\nvar vectorBuffer = new Vector2InputBuffer();\n\nvectorBuffer.Set(Vector2.one);\n\nDebug.Log(vectorBuffer.value); // Will log (1.00, 1.00)\n```\n\n## Recomendations\n\n* **Don't** reuse single `InputBuffer` instance for various input actions: one instance for *jumping*, another for *dashing*, etc;\n* **Use** `.hasBuffer` check each frame in order not to miss a frame where you might execute your buffered action;\n\n## Having trouble or a feature request?\n\nCreate an issue and I'll do my best to help you or add a new usefull feature to that package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadeyellow%2Finputbuffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadeyellow%2Finputbuffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadeyellow%2Finputbuffer/lists"}