needle-tools / unity-analyzers-starter

Custom Analyzers Sample / Starter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unity Analyzer test/dev package.

The included solution is setup to copy the dll to the package on build time

Introduction

  • Analyzers are dlls in Unity
  • They apply globally if they are outside of an asmdef (can be inside a package) or locally when inside a package
  • Dll settings: turn everything off (Auto Reference, Validate References, Any Platform, Editor, Standalone) and add an AssetTag named "RoslynAnalyzer" (the tags ui is not visible inside packages...)

Examples of Analyzers usage (included in this template)

  • Analyzers allow you to run fixes in your IDE:
    image

  • Analyzers allow you to produce logs, warnings, errors or even compiler errors image

Updating the Analyzer

  • Open analyzers/UnityAnalyzers.sln
  • Build UnityAnalyzers.csproj
  • The dll is copied to the package folder on build and Unity reimports the dll. Done.

Unity Documentation

Debugging

#if DEBUG
            if (!Debugger.IsAttached)
            {
                Debugger.Launch();
            }
#endif 

When using Rider set Rider as the default JIT debugger in Settings/Debugger and clicking the Set As Default Debugger button image

Other Resources

About

Custom Analyzers Sample / Starter


Languages

Language:C# 100.0%