Example #1
0
        public void PrefabUtility_GetCorrespondingObjectFromSource_AssetAsRoot()
        {
            RuntimeUrdf.runtimeModeEnabled = false;
            var instantiated = PrefabUtility.InstantiatePrefab(testObject);

            Assert.AreEqual(testObject, RuntimeUrdf.PrefabUtility_GetCorrespondingObjectFromSource(instantiated));
        }
Example #2
0
        public static void CreateMatchingMeshCollision(Transform parent, Transform visualToCopy)
        {
            if (visualToCopy.childCount == 0)
            {
                return;
            }

            GameObject objectToCopy = visualToCopy.GetChild(0).gameObject;
            GameObject prefabObject = (GameObject)RuntimeUrdf.PrefabUtility_GetCorrespondingObjectFromSource(objectToCopy);

            GameObject collisionObject;

            if (prefabObject != null)
            {
                collisionObject = (GameObject)RuntimeUrdf.PrefabUtility_InstantiatePrefab(prefabObject);
            }
            else
            {
                collisionObject = Object.Instantiate(objectToCopy);
            }

            collisionObject.name = objectToCopy.name;
            ConvertMeshToColliders(collisionObject);

            collisionObject.transform.SetParentAndAlign(parent);
        }
Example #3
0
 private static string GetPrefabPath(GameObject gameObject)
 {
     return(RuntimeUrdf.AssetDatabase_GetAssetPath(RuntimeUrdf.PrefabUtility_GetCorrespondingObjectFromSource(gameObject)));
 }