MCPcopy Create free account
hub / github.com/esengine/esengine / Entity

Class Entity

packages/core/src/ECS/Entity.ts:61–872  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 * ```
60 */
61export class Entity {
62 /**
63 * @zh Entity专用日志器
64 * @en Entity logger
65 */
66 private static _logger = createLogger('Entity');
67
68 /**
69 * @zh 实体名称
70 * @en Entity name
71 */
72 public name: string;
73
74 /**
75 * @zh 实体唯一标识符(运行时ID),用于快速查找
76 * @en Unique entity identifier (runtime ID) for fast lookups
77 */
78 public readonly id: number;
79
80 /**
81 * @zh 持久化唯一标识符(GUID)
82 * @en Persistent unique identifier (GUID)
83 *
84 * @zh 用于序列化/反序列化时保持实体引用一致性,在场景保存和加载时保持不变
85 * @en Used to maintain entity reference consistency during serialization/deserialization, remains stable across save/load cycles
86 */
87 public readonly persistentId: string;
88
89 /**
90 * @zh 轻量级实体句柄
91 * @en Lightweight entity handle
92 *
93 * @zh 数值类型的实体标识符,包含索引和代数信息。
94 * 用于高性能场景下替代对象引用,支持 Archetype 存储等优化。
95 * @en Numeric identifier containing index and generation.
96 * Used for high-performance scenarios instead of object references,
97 * supports Archetype storage optimizations.
98 */
99 private _handle: EntityHandle = NULL_HANDLE;
100
101 /**
102 * @zh 所属场景引用
103 * @en Reference to the owning scene
104 */
105 public scene: IScene | null = null;
106
107 /**
108 * @zh 销毁状态标志
109 * @en Destroyed state flag
110 */
111 private _isDestroyed: boolean = false;
112
113 /**
114 * @zh 激活状态
115 * @en Active state
116 */
117 private _active: boolean = true;
118

Callers

nothing calls this directly

Calls 2

createLoggerFunction · 0.90
cloneMethod · 0.45

Tested by

no test coverage detected