Skip to content

Commit 33a2425

Browse files
committed
Merge branch 'ext-events-improvements' into main
2 parents 07dd8e8 + e07a3f9 commit 33a2425

30 files changed

+533
-536
lines changed
0 Bytes
Loading

.images/no-elements.png

137 Bytes
Loading

.images/one-dynamic-arg.png

5.69 KB
Loading
3.65 KB
Loading

.images/performance-graph.png

6.69 KB
Loading

.images/static-listener.png

4.43 KB
Loading

.images/string-argument.png

4.47 KB
Loading

Editor/AOTGeneration/AOTAssemblyGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ private static void GetCodeToGenerate(out HashSet<CreateMethod> methods, out Has
121121
methods = new HashSet<CreateMethod>();
122122
argumentTypes = new HashSet<Type>();
123123

124-
var serializedObjects = SerializedObjectFinder.GetSerializedObjects();
125-
var extEventProperties = ExtEventProjectSearcher.FindExtEventProperties(serializedObjects);
124+
var serializedObjects = ProjectWideSearcher.GetSerializedObjectsInProject();
125+
var extEventProperties = SerializedPropertyHelper.FindPropertiesOfType(serializedObjects, "ExtEvent");
126126
var methodInfos = ExtEventProjectSearcher.GetMethods(extEventProperties);
127127

128128
foreach (var methodInfo in methodInfos)

Editor/AOTGeneration/BuildPreprocessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class BuildPreprocessor : IPreprocessBuildWithReport
99
{
1010
public int callbackOrder => EditorPackageSettings.BuildCallbackOrder;
11-
11+
1212
public void OnPreprocessBuild(BuildReport report)
1313
{
1414
if (PlayerSettings.GetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup) !=
@@ -18,7 +18,7 @@ public void OnPreprocessBuild(BuildReport report)
1818
return;
1919
}
2020

21-
#if UNITY_2021_1_OR_NEWER
21+
#if UNITY_2021_2_OR_NEWER
2222
switch (EditorUserBuildSettings.il2CppCodeGeneration)
2323
{
2424
case Il2CppCodeGeneration.OptimizeSpeed:

Editor/AOTGeneration/ExtEventProjectSearcher.cs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,13 @@
44
using System.Collections.Generic;
55
using System.Reflection;
66
using SolidUtilities;
7+
using SolidUtilities.Editor;
78
using TypeReferences;
89
using UnityEditor;
910
using UnityEngine.Events;
1011

1112
public static class ExtEventProjectSearcher
1213
{
13-
public static IEnumerable<SerializedProperty> FindExtEventProperties(
14-
IEnumerable<SerializedObject> serializedObjects)
15-
{
16-
foreach (var serializedObject in serializedObjects)
17-
{
18-
foreach (var serializedProperty in FindExtEventProperties(serializedObject))
19-
{
20-
yield return serializedProperty;
21-
}
22-
}
23-
}
24-
2514
public static IEnumerable<MethodInfo> GetMethods(IEnumerable<SerializedProperty> extEventProperties)
2615
{
2716
foreach (var extEventProperty in extEventProperties)
@@ -40,35 +29,6 @@ public static IEnumerable<MethodInfo> GetMethods(IEnumerable<SerializedProperty>
4029
}
4130
}
4231

43-
private static IEnumerable<SerializedProperty> FindExtEventProperties(SerializedObject serializedObject)
44-
{
45-
var prop = serializedObject.GetIterator();
46-
47-
if (!prop.Next(true))
48-
yield break;
49-
50-
do
51-
{
52-
if (prop.type.GetSubstringBefore('`') != "ExtEvent")
53-
continue;
54-
55-
if (prop.isArray)
56-
{
57-
int arrayLength = prop.arraySize;
58-
59-
for (int i = 0; i < arrayLength; i++)
60-
{
61-
yield return prop.GetArrayElementAtIndex(i);
62-
}
63-
}
64-
else
65-
{
66-
yield return prop;
67-
}
68-
}
69-
while (prop.NextVisible(true));
70-
}
71-
7232
private static class ResponseHelper
7333
{
7434
public static MethodInfo GetMethod(SerializedProperty response)

0 commit comments

Comments
 (0)