public static void BakeGameObjectComponents(GameObject sourceGO, GameObject targetGO, string assetName, string outputPath, bool bIsInstancer) { UnityEngine.Object assetDBObject = null; Dictionary<Mesh, Mesh> sourceToTargetMeshMap = new Dictionary<Mesh, Mesh>(); Dictionary<Material, Material> sourceToCopiedMaterials = new Dictionary<Material, Material>(); string newAssetDBObjectFileName = HEU_AssetDatabase.AppendMeshesAssetFileName(assetName); HEU_PartData.BakePartToGameObject( partData: null, srcGO: sourceGO, targetGO: targetGO, assetName: assetName, bIsInstancer: bIsInstancer, bDeleteExistingComponents: false, // Materials might be overwritten if true bDontDeletePersistantResources: false, bWriteMeshesToAssetDatabase: true, bakedAssetPath: ref outputPath, sourceToTargetMeshMap, sourceToCopiedMaterials, assetDBObject: ref assetDBObject, assetObjectFileName: newAssetDBObjectFileName, bReconnectPrefabInstances: false, bKeepPreviousTransformValues: false ); }