private void UpdateCurrentBT(GameObject gameObject) { Debug.Log("Getting bt instance " + gameObject.GetComponent <BaseAI>().GetBehaviourTreeDataInstance()); if (gameObject.GetComponent <BaseAI>().GetBehaviourTreeDataInstance() != null) { GraphSaveUtility.GetInstance(_graphView).LoadGraph(gameObject.GetComponent <BaseAI>().GetBehaviourTreeDataInstance()); } }
// Save/Load function private void RequestDataOperation(bool save) { if (string.IsNullOrEmpty(_fileName) || _fileName.Contains("/")) { if (fileLoadField.value == null) { EditorUtility.DisplayDialog("Invalid file name!", "Please enter a valid filename, " + "name should not contain special characters such as /", "Ok"); } } GraphSaveUtility saveUtility = GraphSaveUtility.GetInstance(_graphView); if (save) { if (fileLoadField.value == null) { saveUtility.SaveGraph(_fileName); Debug.Log("Saving graph " + _fileName + "..."); } else { saveUtility.SaveGraph((BTDataContainer)fileLoadField.value); Debug.Log("Saving graph to: " + fileLoadField.value.name + "..."); fileLoadField.value = null; } } else { if (fileLoadField.value == null) { saveUtility.LoadGraph(_fileName); Debug.Log("Loading graph: " + _fileName + "..."); } else { saveUtility.LoadGraph((BTDataContainer)fileLoadField.value); Debug.Log("Loading graph from: " + fileLoadField.value.name + "..."); } } }