Skip to content

Commit 60902e7

Browse files
author
aaron.winter
committed
added entity as meta
1 parent 8b4cd1d commit 60902e7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Godot.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ public interface ISpawnable
1313
void Spawn(EntityBuilder entityBuilder);
1414
}
1515

16+
public class Marshallable<T> : Reference where T: class
17+
{
18+
public T Value;
19+
public Marshallable(T value) => Value = value;
20+
}
21+
1622
public static class GodotExtensions
1723
{
1824
public static Entity Spawn(this World world, Node root)
@@ -25,7 +31,8 @@ public static Entity Spawn(this World world, Node root)
2531
public static void AttachNode(this World world, Entity entity, Node root)
2632
{
2733
world.AddComponent(entity.Identity, new Root { Node = root });
28-
34+
root.SetMeta("Entity", new Marshallable<Entity>(entity));
35+
2936
var nodes = root.GetChildren().Cast<Node>().Prepend(root).ToList();
3037

3138
foreach (var node in nodes)

0 commit comments

Comments
 (0)