Please see this example code below. It adds an Entity, you see the current Entity number rises in the debug list. The next second, the Entity is deleted but the debug panel is not updated on engine.removeEntity(). I'm on 7.3.30. This issue is not really important for the scene but it is important for the consistency of the debug panel.
´´´ts
---index.ts---
let itemToDelete: Entity | null
let elapsedTime = 0
export function main() {
//This code each second adds and Entity
//and deletes it the next second
engine.addSystem((dt: number) => {
elapsedTime += dt
if (elapsedTime > 1 ) {
elapsedTime = 0
if (itemToDelete != null) {
engine.removeEntity(itemToDelete)
itemToDelete = null
return
}
const newBox = engine.addEntity()
Transform.create(newBox, {position: Vector3.create(5, 1, 5), scale: Vector3.create(1, 1, 1)})
MeshRenderer.setBox(newBox)
itemToDelete = newBox
}
})
}
´´´
Please see this example code below. It adds an Entity, you see the current Entity number rises in the debug list. The next second, the Entity is deleted but the debug panel is not updated on engine.removeEntity(). I'm on 7.3.30. This issue is not really important for the scene but it is important for the consistency of the debug panel.
´´´ts ---index.ts--- let itemToDelete: Entity | null let elapsedTime = 0
export function main() { //This code each second adds and Entity //and deletes it the next second engine.addSystem((dt: number) => { elapsedTime += dt if (elapsedTime > 1 ) { elapsedTime = 0 if (itemToDelete != null) { engine.removeEntity(itemToDelete) itemToDelete = null return } const newBox = engine.addEntity() Transform.create(newBox, {position: Vector3.create(5, 1, 5), scale: Vector3.create(1, 1, 1)}) MeshRenderer.setBox(newBox) itemToDelete = newBox } }) } ´´´
Reported on Discord by Beyto A. (beytoa)