fixed GameObject initialization

This commit is contained in:
Timerix 2025-04-21 21:19:17 +05:00
parent 5c247ce032
commit 51259e72fe

View File

@ -26,15 +26,15 @@ public class GameObject
public Transform Transform { get; } public Transform Transform { get; }
public GameObject? Parent; public GameObject? Parent;
public Dictionary<Type, Component> Components = new(); public Dictionary<Type, Component> Components;
private GameObject(ulong id, uint nativePoolIndex) private GameObject(ulong id, uint nativePoolIndex)
{ {
_id = id; _id = id;
_index = nativePoolIndex; _index = nativePoolIndex;
// constructor doesn't work without writing to console // Do not move this line or mono runtime will throw SEGFAULT.
// TODO: FIX THIS BULLSHIT // Mono runtime can't set values in field declaration, but initializing everything in constructor is OK.
Console.WriteLine($"GameObject(id: {id}, nativePoolIndex: {nativePoolIndex})"); Components = new();
} }
static public GameObject Create() static public GameObject Create()