JetBrains / JetBrains/resharper-unity
Warn against using Mesh.vertices/Mesh.colors/... (causes GC allocation)
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 142
- PR merge metrics
- No merged PRs in 30d
Description
Unity has a few properties to access mesh data, such as [Mesh.vertices](https://docs.unity3d.com/ScriptReference/Mesh-vertices.html). Little did I know I shot myself in the foot with these calls as they actually create garbage every time. Instead it is advisable for the user to allocate a list and re-use it with [Mesh.GetVertices](https://docs.unity3d.com/ScriptReference/Mesh.GetVertices.html) and [Mesh.SetVertices](https://docs.unity3d.com/ScriptReference/Mesh.SetVertices.html). The same is true with several other properties such as `colors`, `normals`, etc. which have `GetX`/`SetX` counterparts.
Contributor guide
Research direction
No repository files or tests are named. Start by reviewing the Unity Mesh.vertices, Mesh.colors, Mesh.normals, and related GetX/SetX APIs linked in the issue, then locate the project entry point for Unity API inspections. Done means the relevant property accesses are warned about and the reusable-list alternatives are communicated clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, unity
- Domain
- performance, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100