From 084aee617c82228eaeae9e5aae44e8a287ea8b77 Mon Sep 17 00:00:00 2001 From: Sinai Date: Wed, 19 May 2021 22:21:08 +1000 Subject: [PATCH] Prevent null reference if Canvas isn't created yet --- src/Core/Input/CursorUnlocker.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Core/Input/CursorUnlocker.cs b/src/Core/Input/CursorUnlocker.cs index 2613804..0a497fe 100644 --- a/src/Core/Input/CursorUnlocker.cs +++ b/src/Core/Input/CursorUnlocker.cs @@ -160,6 +160,16 @@ namespace UnityExplorer.Core.Input public static void Prefix_EventSystem_set_current(ref EventSystem value) { + if (!UIManager.EventSys) + { + if (value) + { + lastEventSystem = value; + lastInputModule = value.currentInputModule; + } + return; + } + if (!settingEventSystem && value != UIManager.EventSys) { lastEventSystem = value;