From 51259e72feabc8a0894a0b9ff0aa0dc1a9a3e119 Mon Sep 17 00:00:00 2001 From: Timerix Date: Mon, 21 Apr 2025 21:19:17 +0500 Subject: [PATCH] fixed GameObject initialization --- src-csharp/GameObject.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src-csharp/GameObject.cs b/src-csharp/GameObject.cs index 0bd6c89..550ec69 100644 --- a/src-csharp/GameObject.cs +++ b/src-csharp/GameObject.cs @@ -26,15 +26,15 @@ public class GameObject public Transform Transform { get; } public GameObject? Parent; - public Dictionary Components = new(); + public Dictionary Components; private GameObject(ulong id, uint nativePoolIndex) { _id = id; _index = nativePoolIndex; - // constructor doesn't work without writing to console - // TODO: FIX THIS BULLSHIT - Console.WriteLine($"GameObject(id: {id}, nativePoolIndex: {nativePoolIndex})"); + // Do not move this line or mono runtime will throw SEGFAULT. + // Mono runtime can't set values in field declaration, but initializing everything in constructor is OK. + Components = new(); } static public GameObject Create()