JetBrains / JetBrains/resharper-unity
Add inspection for script with name of built in component, e.g. "Grid"
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 142
- PR merge metrics
- No merged PRs in 30d
Description
If a script has the same name as a built in component, the following warning is displayed in the Unity console:
> Script 'Grid' has the same name as built-in Unity component.
> AddComponent and GetComponent will not work with this script.
Presumably, this means `GameObject.AddComponent(string)` and `GameObject.GetComponent(string)`, both of which are marked as obsolete, and should be replaced with typesafe versions, using `typeof` or type parameters.
However, the warning remains. Add an inspection to mimic this warning inside the code editor.
Also, add a code inspection wiki entry to provide more details. Will probably need more information on the list of known components and why it doesn't work with `AddComponent`/`GetComponent`.
Contributor guide
Assessment
This issue has not been assessed yet.