public static MaterialExistence CheckIfMaterialExists(MouldingColour.Id id) { if (File.Exists(MaterialPathUtility.GetPath(id))) { return(MaterialExistence.Current); } if (File.Exists(MaterialPathUtility.GetPath(id, true))) { return(MaterialExistence.Legacy); } // FIXME Remove when colour palette experiments are over. #if UNITY_EDITOR if (MouldingColour.GetBI()) { if (File.Exists(MaterialPathUtility.GetPath(id, false, true))) { return(MaterialExistence.Current); } if (File.Exists(MaterialPathUtility.GetPath(id, true, true))) { return(MaterialExistence.Legacy); } } #endif return(MaterialExistence.None); }
private Material GetMaterial(int id) { // FIXME Remove when colour palette experiments are over. var useBI = MouldingColour.GetBI(); var path = MaterialPathUtility.GetPath((MouldingColour.Id)id, false, useBI); if (File.Exists(path)) { return(AssetDatabase.LoadAssetAtPath <Material>(path)); } else { path = MaterialPathUtility.GetPath((MouldingColour.Id)id, true, useBI); return(AssetDatabase.LoadAssetAtPath <Material>(path)); } }
public static Material LoadMaterial(MouldingColour.Id id, bool legacy) { // FIXME Remove when colour palette experiments are over. #if UNITY_EDITOR if (MouldingColour.GetBI()) { var biMaterial = AssetDatabase.LoadAssetAtPath <Material>(MaterialPathUtility.GetPath(id, legacy, true)); if (biMaterial) { return(biMaterial); } } #endif #if UNITY_EDITOR return(AssetDatabase.LoadAssetAtPath <Material>(MaterialPathUtility.GetPath(id, legacy))); #else return(null); #endif }