Home

Awesome

UnityRefChecker

Unassigned reference warnings at compile time, across scenes.

UnityRefChecker helps you avoid null references in MonoBehaviours by looking through all MonoBehaviour references in a scene and warning you in Unity's console if a reference has not been assigned.

Fields that cause a log:

Example

Here are some example logs:

Example logs

Getting Started

  1. Open your Unity project

  2. Clone this project into the Assets/ folder

  3. Add the [IgnoreRefChecker] attribute in front of any members that you wish to keep unassigned

  4. In Unity, go to Window -> UnityRefChecker to run commands and configure settings

Commands

Attributes

Settings

PropertyDescriptionDefault Value
Check after compilationRuns the Check All Build Scenes command every time Unity finishes compilingfalse
Log typeThe severity of the log using Unity's LogType (Error, Log, Warning)Error
Colorful logsAdds color to the Unity console logs to highlight important infotrue

TODO

Testing

To test UnityRefChecker create a new Unity project, clone UnityRefChecker and set up a scene like this:

Test scene

Then open the UnityRefChecker Window and run commands. The RefCheckerTestComponent has the expected results as comments.