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:
- Unassigned public MonoBehaviour fields that do not have [IgnoreRefChecker] or [HideInInspector]
- Unassigned private MonoBehaviour fields that do not have [IgnoreRefChecker] and do have [SerializeField]
Here are some example logs:
Open your Unity project
Clone this project into the
[IgnoreRefChecker]attribute in front of any members that you wish to keep unassigned
In Unity, go to
Window -> UnityRefCheckerto run commands and configure settings
Check All Build Scenes- Checks all MonoBehaviour references in all scenes listed in the Unity Build Settings
Check Open Scene- Checks all MonoBehaviour references in the currently active scene
IgnoreRefChecker- Add this attribute to fields that you wish to keep unassigned. UnityRefChecker will not warn you about these fields
|Check after compilation||Runs the
|Log type||The severity of the log using Unity's LogType (Error, Log, Warning)||Error|
|Colorful logs||Adds color to the Unity console logs to highlight important info||true|
- Make video tutorial showing the problem this solves
- Include prefabs in checks
- Add to Unity Asset Store
To test UnityRefChecker create a new Unity project, clone UnityRefChecker and set up a scene like this:
Then open the UnityRefChecker Window and run commands. The RefCheckerTestComponent has the expected results as comments.