Skip to content

Creating a second MyGame::BaseBallScript in the demo project triggers an assertion failure #19

@JmgrArt

Description

@JmgrArt

Hi !
When running the example project and scene, duplicating the "GameObject with a BallScript" GameObject in the Editor or creating a second GameObject with the same component within PluginMain triggers an assertion failure.

image

Commit: 60450d4
Unity: 2017.4.5f1 64 bit
OS: Windows 10
Compiler: MSVC 2017, 64 bit

This seems to originate from the free list management for whole objects. The following patch seems to partially fix the issue when instantiating a second component within PluginMain.

diff --git a/Unity/Assets/NativeScript/Editor/GenerateBindings.cs b/Unity/Assets/NativeScript/Editor/GenerateBindings.cs
index 013fa39..c988c19 100644
--- a/Unity/Assets/NativeScript/Editor/GenerateBindings.cs
+++ b/Unity/Assets/NativeScript/Editor/GenerateBindings.cs
@@ -10162,9 +10162,9 @@ namespace NativeScript.Editor
 			outputFirstBoot.Append("\t\t{\n");
 			outputFirstBoot.Append("\t\t\tPlugin::");
 			outputFirstBoot.Append(bindingTypeName);
-			outputFirstBoot.Append("FreeWholeList[i].Next = Plugin::");
+			outputFirstBoot.Append("FreeWholeList[i].Next = (Plugin::");
 			outputFirstBoot.Append(bindingTypeName);
-			outputFirstBoot.Append("FreeWholeList[i + 1].Next;\n");
+			outputFirstBoot.Append("FreeWholeList + i + 1);\n");
 			outputFirstBoot.Append("\t\t}\n");
 
 			outputFirstBoot.Append("\t\tPlugin::");

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions