Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UNT0026 editor only #290

Open
smitdylan2001 opened this issue Aug 15, 2023 · 2 comments
Open

UNT0026 editor only #290

smitdylan2001 opened this issue Aug 15, 2023 · 2 comments
Labels
question Further information is requested

Comments

@smitdylan2001
Copy link

Bug description

UNT0026 is not really needed as the issue is only on the editor side.
TryGetComponent can be used for editor tools for better performance, but there is no real runtime performance benefit, and it can even be slower.
Either the message should be adjusted or the rules should be ignored

More info here: https://forum.unity.com/threads/getcomponent-does-not-allocate.1471770/

@sailro
Copy link
Member

sailro commented Aug 15, 2023

Thank you, we are going to reassess the relevance of this diagnostic.

Meanwhile, you can easily suppress any rule you do not find useful though:
https://learn.microsoft.com/en-us/visualstudio/code-quality/in-source-suppression-overview?view=vs-2022&tabs=csharp

Perhaps the best way is to use an .editorconfig file with the following:

[*.cs]
dotnet_diagnostic.UNT0026.severity = none

@sailro sailro added the question Further information is requested label Aug 15, 2023
@sailro
Copy link
Member

sailro commented Aug 15, 2023

cc @jbevain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants