/// <summary> /// Create /// </summary> /// <returns></returns> public pLab_SunPositionData Create() { #if UNITY_EDITOR //Editor only tag string scene = EditorSceneManager.GetActiveScene().name; pLab_SunPositionData asset = ScriptableObject.CreateInstance <pLab_SunPositionData>(); AssetDatabase.CreateAsset(asset, "Assets/SUNPosition_" + scene + ".asset"); AssetDatabase.SaveAssets(); return(asset); #endif return(null); }
/// <summary> /// Open /// </summary> /// <returns></returns> public pLab_SunPositionData Open() { #if UNITY_EDITOR //Editor only tag pLab_SunPositionData asset = AssetDatabase.LoadAssetAtPath("Assets/SUNPosition_" + EditorSceneManager.GetActiveScene().name + ".asset", typeof(pLab_SunPositionData)) as pLab_SunPositionData; if (asset == null) { asset = Create(); } if (asset == null) { return(null); } return(asset); #endif return(null); }