@@ -323,6 +323,7 @@ public void TestNodeVisibility()
323
323
// create test hierarchy
324
324
// root (enabled)
325
325
// -- parent1 (enabled)
326
+ // ---- child3 (disabled)
326
327
// -- parent2 (disabled)
327
328
// ---- child1 (disabled)
328
329
// ---- child2 (enabled)
@@ -337,17 +338,21 @@ public void TestNodeVisibility()
337
338
child1 . name = "child1" ;
338
339
var child2 = GameObject . CreatePrimitive ( PrimitiveType . Cube ) ;
339
340
child2 . name = "child2" ;
341
+ var child3 = GameObject . CreatePrimitive ( PrimitiveType . Cube ) ;
342
+ child3 . name = "child3" ;
340
343
341
344
parent1 . transform . SetParent ( root . transform ) ;
342
345
parent2 . transform . SetParent ( root . transform ) ;
343
346
child1 . transform . SetParent ( parent2 . transform ) ;
344
347
child2 . transform . SetParent ( parent2 . transform ) ;
348
+ child3 . transform . SetParent ( parent1 . transform ) ;
345
349
346
350
root . SetActive ( true ) ;
347
351
parent1 . SetActive ( true ) ;
348
352
child2 . SetActive ( true ) ;
349
353
parent2 . SetActive ( false ) ;
350
354
child1 . SetActive ( false ) ;
355
+ child3 . SetActive ( false ) ;
351
356
352
357
string filename = GetRandomFbxFilePath ( ) ;
353
358
ModelExporter . ExportObject ( filename , root ) ;
@@ -362,11 +367,9 @@ public void TestNodeVisibility()
362
367
var isParent1 = child . name . Equals ( "parent1" ) ;
363
368
CheckObjectVisibility ( child . gameObject , isParent1 ) ;
364
369
365
- if ( isParent1 ) {
366
- // all of parent1's children should be disabled
367
- foreach ( Transform c in child ) {
368
- CheckObjectVisibility ( c . gameObject , false ) ;
369
- }
370
+ // all children should be disabled
371
+ foreach ( Transform c in child ) {
372
+ CheckObjectVisibility ( c . gameObject , false ) ;
370
373
}
371
374
}
372
375
}
0 commit comments