We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 44b0953 commit bf3e54aCopy full SHA for bf3e54a
1 file changed
editor/client/ui/behavior-panel/behavior-list.ts
@@ -1,6 +1,7 @@
1
import {
2
Behavior,
3
BehaviorConstructor,
4
+ BehaviorDestroyed,
5
BehaviorSpawned,
6
ClientGame,
7
Entity,
@@ -156,6 +157,16 @@ export class BehaviorList {
156
157
this.editors.set(newBehavior.ref, editor);
158
this.addBehavior(newBehavior);
159
});
160
+
161
+ this.entity.on(BehaviorDestroyed, ({ behavior }) => {
162
+ const existingBehaviorIdx = this.behaviors.findIndex(it => it.ref === behavior.ref);
163
+ if (existingBehaviorIdx !== -1) this.behaviors.splice(existingBehaviorIdx, 1);
164
165
+ const editor = this.editors.get(behavior.ref);
166
+ if (!editor) return;
167
+ this.editors.delete(behavior.ref);
168
+ editor.details.remove();
169
+ });
170
}
171
172
this.#drawAddBehavior(ui);
0 commit comments