{"id":15065754,"url":"https://github.com/gilzoide/unity-texture-apply-async","last_synced_at":"2025-04-06T02:11:26.263Z","repository":{"id":224364366,"uuid":"763079214","full_name":"gilzoide/unity-texture-apply-async","owner":"gilzoide","description":"Alternative to Texture2D.Apply() that doesn't require synchronizing with the render thread, avoiding stalls in the main thread","archived":false,"fork":false,"pushed_at":"2024-12-30T18:02:26.000Z","size":726,"stargazers_count":121,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-30T01:11:23.915Z","etag":null,"topics":["async","asynchronous","plugin","texture","texture2d","unity","unity2d","unity3d","unity3d-plugin","upm","upm-package"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gilzoide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["gilzoide"],"patreon":null,"open_collective":null,"ko_fi":"gilzoide","tidelift":null,"community_bridge":null,"liberapay":"gilzoide","issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"polar":null,"custom":null}},"created_at":"2024-02-25T14:03:34.000Z","updated_at":"2025-02-10T12:56:38.000Z","dependencies_parsed_at":"2024-04-27T19:27:31.934Z","dependency_job_id":"ee40cd97-2886-4c76-96c6-90afe3c38136","html_url":"https://github.com/gilzoide/unity-texture-apply-async","commit_stats":{"total_commits":41,"total_committers":1,"mean_commits":41.0,"dds":0.0,"last_synced_commit":"bc248b14ec5a4f874efd48828f05e6276e02f009"},"previous_names":["gilzoide/unity-texture-apply-async"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-texture-apply-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-texture-apply-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-texture-apply-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-texture-apply-async/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gilzoide","download_url":"https://codeload.github.com/gilzoide/unity-texture-apply-async/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423515,"owners_count":20936626,"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":["async","asynchronous","plugin","texture","texture2d","unity","unity2d","unity3d","unity3d-plugin","upm","upm-package"],"created_at":"2024-09-25T00:47:18.905Z","updated_at":"2025-04-06T02:11:26.237Z","avatar_url":"https://github.com/gilzoide.png","language":"C","readme":"# Texture Apply Async\n[![openupm](https://img.shields.io/npm/v/com.gilzoide.texture-apply-async?label=openupm\u0026registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.gilzoide.texture-apply-async/)\n\nAlternative to [Texture2D.Apply()](https://docs.unity3d.com/ScriptReference/Texture2D.Apply.html) that doesn't require synchronizing with the render thread, avoiding stalls in the main thread.\n\n\n## Features\n- Asynchronous texture data update in CPU in the render thread, avoiding stalls in the main thread\n- Supports Unity's Built-in Render Pipeline as well as Scriptable Render Pipelines (e.g: URP and HDRP).\n- To guarante the texture is applied before appearing in the screen:\n  + In BRP, updates are scheduled in the first Camera's `Camera.onPreRender` event\n  + In SRP, updates are scheduled in `RenderPipelineManager.beginContextRendering` event\n- Supports registering for updates every frame or for a single frame\n- Prebuilt for Windows, Linux, macOS and Android\n- Built from source in iOS, tvOS, visionOS and WebGL projects\n\n\n## Caveats\n- You should not update the texture's data while the camera/render pipeline is rendering, or else garbage data could be applied to the texture.\n\n\n## How to install\nEither:\n- Use the [openupm registry](https://openupm.com/) and install this package using the [openupm-cli](https://github.com/openupm/openupm-cli):\n  ```\n  openupm add com.gilzoide.texture-apply-async\n  ```\n- Install using the [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui-giturl.html) with the following URL:\n  ```\n  https://github.com/gilzoide/unity-texture-apply-async.git#1.2.0\n  ```\n- Clone this repository or download a snapshot of it directly inside your project's `Assets` or `Packages` folder.\n\n\n## Samples\n- [Random Colors](Samples~/RandomColors): simple sample with a UI that shows random colors.\n- [Plasma Color Job](Samples~/PlasmaColorJob): sample scene with a plasma effect UI that is updated using the C# Job System.\n\n\n## How to use\n```cs\nusing Gilzoide.TextureApplyAsync;\n\n// 1. Create a `TextureApplyAsyncHandle` for your texture.\nvar textureApplyAsyncHandle = new TextureApplyAsyncHandle(myTexture);\n\n// 2. If you want to update your texture every frame,\n// schedule the apply handle to update every frame.\ntextureApplyAsyncHandle.ScheduleUpdateEveryFrame();\n\n// 3. Update the texture data normally.\nfor (int x = 0; x \u003c myTexture.width; x++)\n{\n    for (int y = 0; y \u003c myTexture.height; y++)\n    {\n        myTexture.SetPixel(x, y, Random.ColorHSV());\n    }\n}\n\n// 4. If you want to update your texture only once,\n// schedule a one-shot update.\ntextureApplyAsyncHandle.ScheduleUpdateOnce();\n\n// 5. Cancel updates if necessary.\n// Works for both one-shot and every frame updates.\ntextureApplyAsyncHandle.CancelUpdates();\n\n// 6. If you ever Reinitialize your Texture, make\n// sure to Reinitialize your TextureApplyAsyncHandle\n// or your app may crash!!!\nmyTexture.Reinitialize(width, height);\nmyTexture.Apply();\ntextureApplyAsyncHandle.Reinitialize();\n\n// 7. Dispose of the `TextureApplyAsyncHandle` when not needed\n// anymore, e.g. inside a component's `OnDestroy`.\ntextureApplyAsyncHandle.Dispose();\n```\n","funding_links":["https://github.com/sponsors/gilzoide","https://ko-fi.com/gilzoide","https://liberapay.com/gilzoide"],"categories":["Texture"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilzoide%2Funity-texture-apply-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilzoide%2Funity-texture-apply-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilzoide%2Funity-texture-apply-async/lists"}