File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,9 @@ private void RemoveEntityScript(int id)
105105 for ( int n = 1 ; n <= len ; n ++ ) {
106106 if ( scripts [ n ] . id != id ) continue ;
107107 for ( ; n < len ; n ++ ) {
108- scripts [ n ] = scripts [ n + 1 ] ;
108+ var script = scripts [ n + 1 ] ;
109+ scripts [ n ] = script ;
110+ scriptMap [ script . id ] = n ;
109111 }
110112 entityScriptCount = len ;
111113 scripts [ len ] = default ;
Original file line number Diff line number Diff line change @@ -369,6 +369,21 @@ public static void Test_3_Simulate_Editor() {
369369 test . Start ( ) ;
370370 test . Update ( ) ;
371371 }
372+
373+ [ Test ]
374+ public static void Test_DeleteEntity ( )
375+ {
376+ var store = new EntityStore ( PidType . RandomPids ) ;
377+ var entity1 = store . CreateEntity ( ) ;
378+ var entity2 = store . CreateEntity ( ) ;
379+
380+ entity1 . AddScript ( new TestScript1 ( ) ) ;
381+ entity2 . AddScript ( new TestScript1 ( ) ) ;
382+
383+ entity1 . DeleteEntity ( ) ;
384+
385+ AreEqual ( "id: 2 [*TestScript1]" , entity2 . ToString ( ) ) ;
386+ }
372387}
373388
374389}
You can’t perform that action at this time.
0 commit comments