Open david-rhodes opened 7 years ago
An alternative would be to make the anonymous methods non-anonymous. :smirk: Although this would increase LOC.
I think Action
s are easier to handle: eg no need to unregister event handler (-=
) when done.
@BergWerkGIS I typically favor the readability of non-anonymous methods, anyway. However, Unity states:
Unintuitively, predefined methods allocate nearly as much memory as closures when passed as arguments under the IL2CPP scripting backend
My understanding was that this is a predefined method, and therefore allocates extra memory. I think the cost is in passing functions around.
From
Map.cs
:As noted from the Unity documentation:
This would require us to remove
Action
as method arguments. Prefer C# events?/cc @brnkhy @isiyu @BergWerkGIS