JetBrains / JetBrains/resharper-unity
Repeated property access could be improved with awareness of SetPositionAndRotation
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 142
- PR merge metrics
- No merged PRs in 30d
Description
The detection of:
```cs
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
// Or
transform.position = Vector3.zero;
transform.rotation = Quaternion.identity;
```
And turning it into:
```cs
transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
// Or
transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
```
Would be a great way to help notify users that these combined APIs exist, instead of making their code grow by introducing a local variable when it may not be necessary.
(Do note that `SetLocalPositionAndRotation` was introduced in 2021.3.11f1)
Contributor guide
Research direction
Start by locating the existing Unity analyzer detection for repeated transform position and rotation assignments; no source file or test entry point is named in the issue. Verify the detection recognizes both local and world forms and reports the corresponding combined API, including the stated Unity version constraint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, unity
- Domain
- game-dev, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100