{"id":31771554,"url":"https://github.com/unityvn/optimize-game-unity","last_synced_at":"2026-02-16T02:19:04.810Z","repository":{"id":317654817,"uuid":"1068289265","full_name":"unityvn/optimize-game-unity","owner":"unityvn","description":"Unity Game Optimization Guide","archived":false,"fork":false,"pushed_at":"2025-10-02T06:44:55.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-10T03:42:19.336Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/unityvn.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-02T06:43:45.000Z","updated_at":"2025-10-02T06:44:58.000Z","dependencies_parsed_at":"2025-10-02T08:34:52.550Z","dependency_job_id":null,"html_url":"https://github.com/unityvn/optimize-game-unity","commit_stats":null,"previous_names":["unityvn/optimize-game-unity"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/unityvn/optimize-game-unity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unityvn%2Foptimize-game-unity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unityvn%2Foptimize-game-unity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unityvn%2Foptimize-game-unity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unityvn%2Foptimize-game-unity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unityvn","download_url":"https://codeload.github.com/unityvn/optimize-game-unity/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unityvn%2Foptimize-game-unity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29498462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T02:07:14.481Z","status":"online","status_checked_at":"2026-02-16T02:03:22.852Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":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-10-10T03:40:18.590Z","updated_at":"2026-02-16T02:19:04.777Z","avatar_url":"https://github.com/unityvn.png","language":null,"readme":"# 🎮 Unity Game Optimization Guide\n\nKhi phát triển game bằng Unity, tối ưu hóa (optimize) là bước quan trọng để đảm bảo **hiệu suất**, **trải nghiệm người chơi**, và **tính tương thích đa nền tảng**.  \nDưới đây là checklist các mảng cần tối ưu, kèm theo gợi ý thực hiện.\n\n---\n\n## 📦 1. Optimize Asset (Tài nguyên)\n- **Texture \u0026 Sprite**\n  - Giảm kích thước, nén (Compression).\n  - Dùng đúng format (ETC2/ASTC cho Android, PVRTC cho iOS).\n  - Sprite Atlas để giảm draw calls.\n- **Model \u0026 Mesh**\n  - Giảm poly count, tránh mesh quá chi tiết.\n  - Dùng LOD (Level of Detail) cho model xa/gần.\n- **Animation**\n  - Baking animation khi có thể.\n  - Giảm số lượng keyframe không cần thiết.\n- **Audio**\n  - Nén file (MP3/OGG).\n  - Streaming nhạc nền dài thay vì load toàn bộ.\n\n---\n\n## 🎨 2. Optimize Rendering (Hiển thị)\n- **Batching**\n  - Static Batching cho object cố định.\n  - Dynamic Batching hoặc GPU Instancing cho object lặp lại.\n- **Lighting**\n  - Bake lightmap thay vì realtime.\n  - Sử dụng Mixed/Static light khi có thể.\n  - Giảm số lượng shadow real-time.\n- **Shader \u0026 Material**\n  - Dùng shader mobile-friendly.\n  - Giảm số lượng material, combine khi có thể.\n- **Camera \u0026 Post-processing**\n  - Hạn chế hiệu ứng nặng (Bloom, SSAO, Motion Blur).\n  - Chỉnh clipping plane hợp lý, chỉ render cần thiết.\n- **Overdraw (2D)**\n  - Tránh sprite trong suốt chồng nhiều lớp.\n  - Sắp xếp layer hợp lý.\n\n---\n\n## ⚙️ 3. Optimize Code \u0026 Logic\n- **Garbage Collection (GC)**\n  - Tránh tạo object liên tục trong `Update()`.\n  - Object Pooling thay vì `Instantiate`/`Destroy`.\n- **Update/FixedUpdate**\n  - Hạn chế logic nặng trong `Update()`.\n  - Dùng Coroutine hoặc event thay cho polling.\n- **Physics**\n  - Giảm số lượng Rigidbody/Collider.\n  - Sử dụng layer collision matrix để tránh tính toán thừa.\n  - Điều chỉnh `Fixed Timestep` phù hợp.\n- **AI/Pathfinding**\n  - Chia nhỏ xử lý theo frame.\n  - Cache kết quả khi có thể.\n\n---\n\n## 🧠 4. Optimize Memory\n- Giải phóng asset không dùng với `Resources.UnloadUnusedAssets` hoặc `Addressables.Release`.\n- Tránh giữ reference asset không cần thiết.\n- Load theo nhu cầu với **Addressables/Asset Bundles** thay vì nhét hết vào build.\n\n---\n\n## 📱 5. Optimize Build \u0026 Platform\n- **Build Settings**\n  - Chọn kiến trúc CPU đúng (ARMv7/ARM64).\n  - Bật Strip Engine Code để giảm dung lượng.\n- **Quality Settings**\n  - Tùy platform mà giảm hiệu ứng hoặc texture size.\n  - Giới hạn FPS hợp lý (ví dụ: 30fps cho game casual mobile).\n- **IL2CPP \u0026 Code Stripping**\n  - Bật Managed Stripping Level để loại bỏ code không dùng.\n\n---\n\n## ✅ Checklist nhanh\n- [ ] Texture nén và atlas hóa.  \n- [ ] Model tối ưu poly, có LOD.  \n- [ ] Lightmap đã bake, hạn chế realtime shadow.  \n- [ ] Shader/material được giảm thiểu.  \n- [ ] Sử dụng batching (static/dynamic/GPU instancing).  \n- [ ] Object pooling thay cho instantiate/destroy.  \n- [ ] Physics và AI được tối ưu.  \n- [ ] Addressables/AssetBundle để quản lý memory.  \n- [ ] Build settings phù hợp nền tảng.  \n- [ ] Managed Stripping Level bật để giảm code thừa.  \n\n---\n\n✨ Tối ưu hóa không phải là một bước cuối cùng, mà là **quá trình liên tục** trong suốt vòng đời phát triển game.  \nHãy profile thường xuyên, phát hiện bottleneck và xử lý kịp thời.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funityvn%2Foptimize-game-unity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funityvn%2Foptimize-game-unity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funityvn%2Foptimize-game-unity/lists"}