@@ -500,6 +500,37 @@ public void TestStaticHelpers()
500
500
501
501
Assert . That ( bReferenceComponent . m_transform . name , Is . EqualTo ( a . transform . name ) ) ;
502
502
}
503
+
504
+ // Test GetSceneReferencesToObject()
505
+ {
506
+ var a = GameObject . CreatePrimitive ( PrimitiveType . Cube ) ;
507
+ var b = new GameObject ( ) ;
508
+ var c = new GameObject ( ) ;
509
+
510
+ var reference = b . AddComponent < ReferenceComponent > ( ) ;
511
+ var constraint = c . AddComponent < UnityEngine . Animations . PositionConstraint > ( ) ;
512
+
513
+ reference . m_collider = a . GetComponent < BoxCollider > ( ) ;
514
+
515
+ var constraintSource = new UnityEngine . Animations . ConstraintSource ( ) ;
516
+ constraintSource . sourceTransform = a . transform ;
517
+ constraintSource . weight = 0.5f ;
518
+ constraint . AddSource ( constraintSource ) ;
519
+
520
+ var sceneRefs = ConvertToNestedPrefab . GetSceneReferencesToObject ( a ) ;
521
+ Assert . That ( sceneRefs . Count , Is . EqualTo ( 2 ) ) ;
522
+ Assert . That ( sceneRefs . Contains ( a ) ) ; // GameObjects also reference themself
523
+ Assert . That ( sceneRefs . Contains ( b ) ) ;
524
+
525
+ sceneRefs = ConvertToNestedPrefab . GetSceneReferencesToObject ( a . GetComponent < BoxCollider > ( ) ) ;
526
+ Assert . That ( sceneRefs . Count , Is . EqualTo ( 1 ) ) ;
527
+ Assert . That ( sceneRefs . Contains ( b ) ) ;
528
+
529
+ sceneRefs = ConvertToNestedPrefab . GetSceneReferencesToObject ( a . transform ) ;
530
+ Assert . That ( sceneRefs . Count , Is . EqualTo ( 2 ) ) ;
531
+ Assert . That ( sceneRefs . Contains ( b ) ) ;
532
+ Assert . That ( sceneRefs . Contains ( c ) ) ;
533
+ }
503
534
}
504
535
505
536
[ Test ]
0 commit comments