public void Initialize(string guid)
        {
            try
            {
                _selectedGuid = guid;
                var asset     = AssetDatabase.LoadAssetAtPath <Object>(AssetDatabase.GUIDToAssetPath(guid));
                var path      = AssetDatabase.GetAssetPath(asset);
                var textGraph = File.ReadAllText(path, Encoding.UTF8);

                _logicGraphEditorObject = CreateInstance <LogicGraphEditorObject>();
                LogicGraphData logicGraphData = JsonUtility.FromJson <LogicGraphData>(textGraph);
                _logicGraphEditorObject.Initialize(logicGraphData);
                LogicGraphEditorView = new LogicGraphEditorView(this, _logicGraphEditorObject)
                {
                    persistenceKey = _logicGraphEditorObject.GetInstanceID().ToString()
                };
                LogicGraphEditorView.RegisterCallback <GeometryChangedEvent>(OnPostLayout);

                titleContent = new GUIContent(_logicGraphEditorObject.name);

                Repaint();
            }
            catch (Exception)
            {
                _graphEditorView        = null;
                _logicGraphEditorObject = null;
                throw;
            }
        }
Example #2
0
 public void Initialize(LogicGraphData logicGraphData)
 {
     _logicGraphData = logicGraphData;
     if (_logicGraphData == null)
     {
         _logicGraphData = new LogicGraphData();
     }
 }
Example #3
0
 public void Initialize(LogicGraphData logicGraphData)
 {
     _logicGraphData = logicGraphData;
 }