Browse Source

Make ThreadingHelper run before other scripts

ManlyMarco 5 years ago
parent
commit
503e39675f
1 changed files with 2 additions and 0 deletions
  1. 2 0
      BepInEx/ThreadingHelper.cs

+ 2 - 0
BepInEx/ThreadingHelper.cs

@@ -10,6 +10,7 @@ namespace BepInEx
 	/// <summary>
 	/// Provides methods for running code on other threads and synchronizing with the main thread.
 	/// </summary>
+	[DefaultExecutionOrder(int.MinValue)]
 	public sealed class ThreadingHelper : MonoBehaviour, ISynchronizeInvoke
 	{
 		private readonly object _invokeLock = new object();
@@ -47,6 +48,7 @@ namespace BepInEx
 
 		private void Update()
 		{
+			// The CurrentThread can change between Awake and later methods, it's safest to get it here.
 			if (_mainThread == null)
 				_mainThread = Thread.CurrentThread;