JetBrains / JetBrains/resharper-unity

Inspections for callback priority attributes

Open
#2,306 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.2k
Forks
142
PR merge metrics
No merged PRs in 30d

Description

The following attributes can be applied to a callback method to control the order of execution.

* [RunAfterClassAttribute](https://docs.unity3d.com/2021.2/Documentation/ScriptReference/Callbacks.RunAfterClassAttribute.html), [RunBeforeClassAttribute](https://docs.unity3d.com/2021.2/Documentation/ScriptReference/Callbacks.RunBeforeClassAttribute.html)
* [RunAfterAssemblyAttribute](https://docs.unity3d.com/2021.2/Documentation/ScriptReference/Callbacks.RunAfterAssemblyAttribute.html), [RunBeforeAssemblyAttribute](https://docs.unity3d.com/2021.2/Documentation/ScriptReference/Callbacks.RunBeforeAssemblyAttribute.html)
* [RunAfterPackageAttribute](https://docs.unity3d.com/2021.2/Documentation/ScriptReference/Callbacks.RunAfterPackageAttribute.html), [RunBeforePackageAttribute](https://docs.unity3d.com/2021.2/Documentation/ScriptReference/Callbacks.RunBeforePackageAttribute.html)

These call-backs are currently only supported by `AssetPostprocessor.OnPostprocessAllAssets`.

Inspections could include:

* Verify that the referenced class includes a similar callback, or that the referenced class has the same base class
* Validation and completion for the string literal for the referenced assembly. Provide feedback if the assembly is missing (not an error - the requirement is ignored when calculating ordering)
* Validation and completion for the string literal for the required package. Can provide an indication (inlay hint?) if the package is installed or not, e.g. showing version.

First introduced in 2022.1

Useful tweets: https://twitter.com/KarlJamesJones/status/1463521992968130563

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Unity callback priority attributes and the existing support for AssetPostprocessor.OnPostprocessAllAssets. Use the listed Unity documentation to define validation and completion for referenced classes, assemblies, and packages; done means the agreed inspections provide the requested feedback for these attributes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.