/// <summary> /// Gets the material reference. /// </summary> /// <returns><c>true</c>, 说明有新资源移动到开发目录 <c>false</c> otherwise.</returns> /// <param name="sharedAsset">Shared asset.</param> /// <param name="tr">Tr.</param> public static bool getMaterialRef(CLSharedAssets sharedAsset, Transform tr) { bool ret = false; bool ret1 = false; bool ret2 = false; bool ret3 = false; Renderer[] rds = tr.GetComponents <Renderer> (); Renderer rd = null; for (int r = 0; r < rds.Length; r++) { rd = rds [r]; if (rd == null) { continue; } if (rd.sharedMaterials != null && rd.sharedMaterials.Length > 0) { for (int i = 0; i < rd.sharedMaterials.Length; i++) { if (rd.sharedMaterials [i] == null) { continue; } Coolape.CLSharedAssets.CLMaterialInfor clMat = new Coolape.CLSharedAssets.CLMaterialInfor(); clMat.render = rd; clMat.index = i; ret1 = ECLEditorUtl.moveAsset4Upgrade(rd.sharedMaterials [i]) || ret1 ? true : false; string materialName = ECLEditorUtl.getAssetName4Upgrade(rd.sharedMaterials [i]); clMat.materialName = materialName; sharedAsset.materials.Add(clMat); // save to cfg file ArrayList propNames = new ArrayList(); ArrayList texNames = new ArrayList(); ArrayList texPaths = new ArrayList(); ret2 = ECLEditorUtl.getTexturesFromMaterial(rd.sharedMaterials [i], ref propNames, ref texNames, ref texPaths) || ret2 ? true : false; saveMaterialTexCfg(materialName, propNames, texNames, texPaths); } } } for (int i = 0; i < tr.childCount; i++) { ret3 = getMaterialRef(sharedAsset, tr.GetChild(i)) || ret3 ? true : false; } return(ret1 || ret2 || ret3); }