Skip to content

Commit fc85fdf

Browse files
committed
fix: Fixed NullReferenceException when entering PlayMode with PlayModeOptions disabled
1 parent 5289e7c commit fc85fdf

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Editor/GenericTypesAnalyzer/GenericTypesAnalyzer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ internal static class GenericTypesAnalyzer
2222
Justification = "We need | instead of || so that all methods are executed before moving to the next statement.")]
2323
private static void AnalyzeGenericTypes()
2424
{
25+
// If PlayOptions is disabled and the domain reload happens on entering Play Mode, no changes to scripts
26+
// can be detected but NullReferenceException is thrown from UnityEditor internals. Since it is useless
27+
// to check changes to scripts in this situation, we can safely ignore this domain reload.
28+
if (EditorApplication.isPlayingOrWillChangePlaymode)
29+
return;
30+
2531
#if GENERIC_UNITY_OBJECTS_DEBUG
2632
using var timer = Timer.CheckInMilliseconds("AnalyzeGenericTypes");
2733
#endif

0 commit comments

Comments
 (0)