public void ReadAsset(string stageID, UnityAction callback) { StartCoroutine(ResourceManager.Instance.LoadScriptableObject("ScriptableObject/StageDatas/" + stageID, (sObj) => { stageScriptable = sObj.asset as StageScriptable; callback(); })); }
private void Export(string exportName) { string exportFilePath = ASSET_PATH + exportName + ".asset"; //stageScriptable = AssetDatabase.LoadAssetAtPath<StageScriptable>(ASSET_PATH + exportName + ".asset"); if (stageScriptable == null) { stageScriptable = ScriptableObject.CreateInstance <StageScriptable>(); } // 新規の場合はディレクトリ作成 if (!AssetDatabase.Contains(stageScriptable as UnityEngine.Object)) { string directory = System.IO.Path.GetDirectoryName(exportFilePath); if (!System.IO.Directory.Exists(directory)) { System.IO.Directory.CreateDirectory(directory); } // アセット作成 AssetDatabase.CreateAsset(stageScriptable, exportFilePath); stageScriptable.Copy(stageScriptable); //ScriptableObjectを設定 SetScriptable(); // 更新通知 EditorUtility.SetDirty(stageScriptable); // 保存 AssetDatabase.SaveAssets(); // エディタを最新の状態にする AssetDatabase.Refresh(); } else { ok_or_canselWindow = CreateInstance <OK_Or_CancelWindow>(); ok_or_canselWindow.ShowUtility(); ok_or_canselWindow.SetOKAction(() => { stageScriptable.Copy(stageScriptable); //ScriptableObjectを設定 SetScriptable(); // 更新通知 EditorUtility.SetDirty(stageScriptable); // 保存 AssetDatabase.SaveAssets(); // エディタを最新の状態にする AssetDatabase.Refresh(); ok_or_canselWindow.Close(); ok_or_canselWindow = null; Layout(); }); ok_or_canselWindow.SetCancelAction(() => { ok_or_canselWindow.Close(); ok_or_canselWindow = null; Layout(); }); } }
private void Import(string loadName) { if (stageScriptable == null) { stageScriptable = ScriptableObject.CreateInstance <StageScriptable>(); } StageScriptable scriptable = AssetDatabase.LoadAssetAtPath <StageScriptable>(ASSET_PATH + loadName + ".asset"); if (scriptable == null) { Debug.Log("ScriptableObjectがnullです"); return; } stageScriptable.Copy(scriptable); stageScriptable = scriptable; stageData = stageScriptable.stageData; }
public void Copy(StageScriptable data) { intValue = data.IntValue; }
private void NewCreate() { stageScriptable = ScriptableObject.CreateInstance <StageScriptable>(); stageData = new StageData(); }