public void PrefabUtility_GetCorrespondingObjectFromSource_AssetAsRoot() { RuntimeUrdf.runtimeModeEnabled = false; var instantiated = PrefabUtility.InstantiatePrefab(testObject); Assert.AreEqual(testObject, RuntimeUrdf.PrefabUtility_GetCorrespondingObjectFromSource(instantiated)); }
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); }
private static string GetPrefabPath(GameObject gameObject) { return(RuntimeUrdf.AssetDatabase_GetAssetPath(RuntimeUrdf.PrefabUtility_GetCorrespondingObjectFromSource(gameObject))); }