JetBrains / JetBrains/resharper-unity
Possible unintended use of undeclared property 'unity_GUIZTestMode'
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 142
- PR merge metrics
- No merged PRs in 30d
Description
All UI shaders need to allow setting of their ZTest via the unity_GUIZTestMode to [work correctly](https://support.unity.com/hc/en-us/articles/115000531226-What-is-the-value-of-shader-ZTest-mode-unity-GUIZTestMode-):
`ZTest [unity_GUIZTestMode]`
Usage of this magic var can also be found in the [standard UI shader](https://github.com/TwoTailsGames/Unity-Built-in-Shaders/blob/master/DefaultResourcesExtra/UI/UI-Default.shader#L44).
Rider does not recognize this and gives the following warning:
> Possible unintended use of undeclared property 'unity_GUIZTestMode'. Property may be set from code
Which isn't incorrect, but perhaps overly eager. Going through this repo I even found a mention of it where I assume the warning originates, but no special case to handle it:
https://github.com/JetBrains/resharper-unity/blob/net221/resharper/resharper-unity/src/Unity.Shaders/ShaderLab/Daemon/Stages/Resolve/ResolveProblemHighlighter.cs#L49
To me it seems that this particular property could be safely ignored and not trigger this warning?
The only potential issue is having this set for a shader that isn't used for UI, don't know which is preferable.
Contributor guide
Research direction
Start with resharper/resharper-unity/src/Unity.Shaders/ShaderLab/Daemon/Stages/Resolve/ResolveProblemHighlighter.cs, where the issue identifies the warning's likely origin. Check how unity_GUIZTestMode is resolved in UI shaders and define completion as avoiding the reported warning for this Unity property without broadly suppressing unrelated undeclared-property warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, unity
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100