0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Unity】BannedApiAnalyzersのハマりポイントと警告をエラーにする方法メモ

Last updated at Posted at 2021-09-25

はじめに

プロジェクトで使用するUnityを2020.3に上げてBannedApiAnalyzersを使えるようになったので以下の記事の内容を試してみた。

いくつかハマりポイントがあって手間取ったのでメモ。

環境

  • Unity 2020.3.16f1
  • Rider 2021.2.1

ハマりポイント

asmdef使ってるとちょっと面倒

Initialize_-SharpenTheKnife-iOS-Unity_2020_3_16f1__Metal.png

参考:

警告じゃなくてエラーにしたい

.editorconfig に以下を足す。

.editorconfig
[*.cs]
dotnet_diagnostic.RS0030.severity = error

もしくは

  • Visual Studio

UnityエディタおよびVisual Studioの場合、ルールセットファイルを使用します。設定方法は公式マニュアルの Roslyn analyzers and ruleset files を参照してください。

  • Rider

Riderの場合は、Preferences... を開き、Editor | Inspection Settings | Roslyn Analyzersの中で設定できます。

引用元:Unityプロジェクト向けRoslynアナライザの作りかた(DeNA Testing Blog)

参考:

個別で設定したい

現状は無理っぽい。

不明点

Rider上では警告・エラーが出るようになったけどUnityエディタ上では出せないんだろうか?🤔

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?