Ejemplo n.º 1
0
        public void OnValidate()
        {
            Debug.Log("OnValidate");

            Debug.Log(_logicGraphObject);

            //there is an issue in unity editor that would cause this reference to be lost even when it shouldn't have
            //this forces it to reconnect the reference in event of that
            if (_logicGraphObject == null)
            {
                _logicGraphObject = EditorUtility.InstanceIDToObject(_editorInstanceId) as LogicGraphObject;
            }

            if (_logicGraphObject != null)
            {
                _editorInstanceId = _logicGraphObject.GetInstanceID();
                Debug.Log(_editorInstanceId);

                _logicGraphObject.LoadLogicNodeGraph(_nodes, _inputNodes, _outputNodes);
                UpdateInputsAndOutputs();

                for (int i = 0; i < Inputs.Count; ++i)
                {
                    if (Inputs[i].ComponentValue != null)
                    {
                        IInputComponent component = Inputs[i].ComponentValue as IInputComponent;
                        if (component != null)
                        {
                            Inputs[i].RegisterValidateEvent(component);
                        }
                    }
                    else if (Inputs[i].Validate != null)
                    {
                        Inputs[i].Validate();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void Reset()
 {
     _inputNodes.Clear();
     _outputNodes.Clear();
     _logicGraphObject = null;
 }