@@ -35,7 +35,7 @@ namespace phasereditor2d.scene.ui.editor.undo {
35
35
36
36
await this . pastePlainObjects ( items , sel ) ;
37
37
38
- this . pastePrefaProperties ( items , sel ) ;
38
+ this . pastePrefabProperties ( items , sel ) ;
39
39
40
40
this . _editor . setSelection ( sel ) ;
41
41
}
@@ -56,7 +56,7 @@ namespace phasereditor2d.scene.ui.editor.undo {
56
56
57
57
this . setNewObjectId ( data ) ;
58
58
59
- const obj = scene . readPlainObject ( data ) ;
59
+ const obj = scene . readPlainObject ( data ) ;
60
60
61
61
if ( obj ) {
62
62
@@ -76,7 +76,7 @@ namespace phasereditor2d.scene.ui.editor.undo {
76
76
}
77
77
}
78
78
79
- private pastePrefaProperties ( clipboardItems : IClipboardItem [ ] , sel : any [ ] ) {
79
+ private pastePrefabProperties ( clipboardItems : IClipboardItem [ ] , sel : any [ ] ) {
80
80
81
81
const scene = this . _editor . getScene ( ) ;
82
82
@@ -169,16 +169,28 @@ namespace phasereditor2d.scene.ui.editor.undo {
169
169
170
170
for ( const newObj of sprites ) {
171
171
172
- const oldLabel = newObj . getEditorSupport ( ) . getLabel ( ) ;
173
-
174
- const newLabel = nameMaker . makeName ( oldLabel ) ;
175
-
176
- newObj . getEditorSupport ( ) . setLabel ( newLabel ) ;
172
+ this . updateGameObjectName ( newObj , nameMaker ) ;
177
173
}
178
174
179
175
maker . afterDropObjects ( prefabObj , sprites ) ;
180
176
}
181
177
178
+ private updateGameObjectName ( obj : sceneobjects . ISceneGameObject , nameMaker : colibri . ui . ide . utils . NameMaker ) {
179
+
180
+ const objES = obj . getEditorSupport ( ) ;
181
+
182
+ const oldLabel = objES . getLabel ( ) ;
183
+
184
+ const newLabel = nameMaker . makeName ( oldLabel ) ;
185
+
186
+ objES . setLabel ( newLabel ) ;
187
+
188
+ for ( const child of objES . getAppendedChildren ( ) ) {
189
+
190
+ this . updateGameObjectName ( child , nameMaker ) ;
191
+ }
192
+ }
193
+
182
194
private setNewObjectId ( data : json . IObjectData ) {
183
195
184
196
data . id = Phaser . Utils . String . UUID ( ) ;
0 commit comments