Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 97325a5

Browse files
committed
Fix an issue causing duplicated clicks in some IL2CPP games, fix setting Component.enabled in IL2CPP
1 parent 82e52de commit 97325a5

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

src/ExplorerCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace UnityExplorer
1616
public class ExplorerCore
1717
{
1818
public const string NAME = "UnityExplorer";
19-
public const string VERSION = "3.1.0";
19+
public const string VERSION = "3.1.1";
2020
public const string AUTHOR = "Sinai";
2121
public const string GUID = "com.sinai.unityexplorer";
2222
public const string EXPLORER_FOLDER = @"Mods\UnityExplorer";

src/Inspectors/GameObjects/ComponentList.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,11 @@ internal void RefreshComponentList()
111111
internal static void OnCompToggleClicked(int index, bool value)
112112
{
113113
var comp = s_compShortlist[index];
114-
114+
#if CPP
115+
comp.TryCast<Behaviour>().enabled = value;
116+
#else
115117
(comp as Behaviour).enabled = value;
118+
#endif
116119
}
117120

118121
internal static void OnCompListObjectClicked(int index)

src/UI/Modules/SearchPage.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
//using TMPro;
54
using UnityEngine;
65
using UnityEngine.SceneManagement;
76
using UnityEngine.UI;
@@ -51,8 +50,6 @@ public class SearchPage : MainMenu.Page
5150
private SceneFilter m_sceneFilter;
5251
private ChildFilter m_childFilter;
5352

54-
internal bool m_isStaticClassSearching;
55-
5653
// ui elements
5754

5855
private Text m_resultCountText;
@@ -257,8 +254,6 @@ internal void OnSearchClicked()
257254

258255
internal void StaticClassSearch()
259256
{
260-
m_isStaticClassSearching = true;
261-
262257
var list = new List<Type>();
263258

264259
var nameFilter = "";
@@ -295,8 +290,6 @@ internal void StaticClassSearch()
295290

296291
private void SingletonSearch()
297292
{
298-
m_isStaticClassSearching = false;
299-
300293
var instances = new List<object>();
301294

302295
var nameFilter = "";
@@ -356,8 +349,6 @@ private void SingletonSearch()
356349

357350
internal void UnityObjectSearch()
358351
{
359-
m_isStaticClassSearching = false;
360-
361352
Type searchType = null;
362353
switch (m_context)
363354
{

src/UI/UIManager.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public static void OnSceneChange()
4646
SearchPage.Instance?.OnSceneChange();
4747
}
4848

49+
#if CPP
50+
internal static float s_timeOfLastClick;
51+
#endif
4952
public static void Update()
5053
{
5154
MainMenu.Instance?.Update();
@@ -54,6 +57,7 @@ public static void Update()
5457
{
5558
if (EventSystem.current != EventSys)
5659
{
60+
ExplorerCore.Log("Forcing EventSystem to UnityExplorer's");
5761
ForceUnlockCursor.SetEventSystem();
5862
}
5963

@@ -62,8 +66,18 @@ public static void Update()
6266
var evt = InputManager.InputPointerEvent;
6367
if (evt != null)
6468
{
65-
if (!evt.eligibleForClick && evt.selectedObject)
66-
evt.eligibleForClick = true;
69+
if (Time.realtimeSinceStartup - s_timeOfLastClick > 0.1f)
70+
{
71+
s_timeOfLastClick = Time.realtimeSinceStartup;
72+
73+
if (!evt.eligibleForClick && evt.selectedObject)
74+
evt.eligibleForClick = true;
75+
}
76+
else
77+
{
78+
if (evt.eligibleForClick)
79+
evt.eligibleForClick = false;
80+
}
6781
}
6882
#endif
6983
}

0 commit comments

Comments
 (0)