/// <summary> /// Saves the combined results. /// </summary> public static void SaveCombinedResults(CombinedResult combinedResult, string folderDestination, string sessionName) { CombinedResult savedCombinedResult = AssetDatabase.LoadAssetAtPath <CombinedResult> (folderDestination + "/CombinedResults_" + sessionName + ".asset"); if (savedCombinedResult != null) { AssetDatabase.DeleteAsset(folderDestination + "/CombinedResults_" + sessionName + ".asset"); } CombinedResult toSaveCombinedResult = GameObject.Instantiate(combinedResult) as CombinedResult; for (int i = 0; i < combinedResult._combinedMaterials.Count; i++) { if (combinedResult._combinedMaterials [i].material != null) { toSaveCombinedResult._combinedMaterials[i].material = (Material)(AssetDatabase.LoadAssetAtPath(folderDestination + "/Materials/" + combinedResult._combinedMaterials [i].material.name + ".mat", typeof(Material))); } } string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(folderDestination + "/CombinedResults_" + sessionName + ".asset"); AssetDatabase.CreateAsset(toSaveCombinedResult, assetPathAndName); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
/// <summary> /// Raises the enable event. /// </summary> private void OnEnable() { _combinedResult = (CombinedResult)target; }
// Use this for initialization void Awake() { // Instanciate a copy of the _combinedResult _currentCombinedResult = GameObject.Instantiate(_combinedResult) as CombinedResult; }