@@ -48,17 +48,18 @@ Scene.newF("translate", function(data, meta) {
4848 stuff . forEach ( ( s , i ) => {
4949 let name = s [ 0 ] . replace ( ":" , "" ) ; // removes the : from the name of the property
5050 let { fileID } = ids [ i ] ; // gets the file id
51- try {
52- let obj = this . __createChild ( name , stuff ) ; // creates a new child obj
53-
54- // this part is mostly just for like making sure that objects get put in Scene.objects and UnityscriptWorkspace.objects
55- if ( obj instanceof this . parent . GameObject ) { this . objects . push ( fileID , obj ) ; this . parent . objects . push ( fileID , obj ) ; }
56- if ( obj instanceof this . parent . Light ) { this . lights . push ( fileID , obj ) ; }
57- if ( obj instanceof this . parent . Camera ) { this . cameras . push ( fileID , obj ) ; }
58-
59- // finally adds it to the children
60- this . children . push ( fileID , obj ) ;
61- } catch ( e ) { }
62-
63- } )
51+ if ( this . parent [ name ] ) {
52+ try {
53+ let obj = this . __createChild ( name , stuff ) ; // creates a new child obj
54+
55+ // this part is mostly just for like making sure that objects get put in Scene.objects and UnityscriptWorkspace.objects
56+ if ( obj instanceof this . parent . GameObject ) { this . objects . push ( fileID , obj ) ; this . parent . objects . push ( fileID , obj ) ; }
57+ if ( obj instanceof this . parent . Light ) { this . lights . push ( fileID , obj ) ; }
58+ if ( obj instanceof this . parent . Camera ) { this . cameras . push ( fileID , obj ) ; }
59+
60+ // finally adds it to the children
61+ this . children . push ( fileID , obj ) ;
62+ } catch ( e ) { }
63+ }
64+ } ) ;
6465} )
0 commit comments