Skip to content

Commit 58d5eec

Browse files
committed
Merge pull request #70 from philipcass/patch-2
Fix CPP event accessors
2 parents b234c91 + 24ab5fa commit 58d5eec

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Unity/Assets/NativeScript/Editor/GenerateBindings.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3427,7 +3427,15 @@ static void AppendEventAddRemoveMethod(
34273427
builders.CsharpFunctions);
34283428
builders.CsharpFunctions.Append('.');
34293429
builders.CsharpFunctions.Append(eventName);
3430-
builders.CsharpFunctions.Append(" += del;");
3430+
// TODO: More safely differenciate between add/removing event delegates
3431+
if (funcName.Contains("RemoveEvent"))
3432+
{
3433+
builders.CsharpFunctions.Append(" -= del;");
3434+
}
3435+
else
3436+
{
3437+
builders.CsharpFunctions.Append(" += del;");
3438+
}
34313439
AppendCsharpFunctionEnd(
34323440
typeof(void),
34333441
null,

0 commit comments

Comments
 (0)