We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 747cd76 commit 2f31b76Copy full SHA for 2f31b76
src/Entity.cs
@@ -67,7 +67,7 @@ public ref T GetOrAdd<T>() where T : struct
67
}
68
public void Delete() => CurrentScene.DeleteEntity(this);
69
70
- public override string ToString() => $"Entity {Id} (v{Version})";
+ public override string ToString() => Has<NameComponent>() ? Get<NameComponent>().Name : $"EID {Id} (v{Version})";
71
72
public override bool Equals(object? obj) => obj is Entity other && this == other;
73
public override int GetHashCode() => (int)(BitOperations.RotateLeft((uint)Id, 16) ^ Version);
src/NameComponent.cs
@@ -0,0 +1,8 @@
1
+namespace SimpleECS
2
+{
3
+ public struct NameComponent
4
+ {
5
+ public string Name;
6
+ public NameComponent(string name) => Name = name;
7
+ }
8
+}
0 commit comments