Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Support "Domain Reload" disabled in a project #480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,17 @@ static MainThreadDispatcher Instance
}
}

#if UNITY_2019_3_OR_NEWER && UNITY_EDITOR
// Clean up static properties for times when Domain Reload is disabled.
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
static void DomainCleanup()
{
initialized = false;
isQuitting = false;
instance = null;
}
#endif

public static void Initialize()
{
if (!initialized)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ public static bool IsPlaying
}
}

#if UNITY_2019_3_OR_NEWER && UNITY_EDITOR
// This callback is notified when Unity initializes subsystems
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
#else
// This callback is notified after scripts have been reloaded.
[DidReloadScripts]
#endif
public static void OnDidReloadScripts()
{
// Filter DidReloadScripts callbacks to the moment where playmodeState transitions into isPlaying.
Expand Down