示例#1
0
    public void UpdateConnectionTransforms()
    {
        if (port.IsInput)
        {
            return;
        }

        while (connections.Count < port.ConnectionCount)
        {
            AddConnection();
        }
        while (connections.Count > port.ConnectionCount)
        {
            Destroy(connections[0].gameObject);
            connections.RemoveAt(0);
        }

        // Loop through connections
        for (int i = port.ConnectionCount - 1; i >= 0; i--)
        {
            NodePort  other     = port.GetConnection(i);
            IUGUINode otherNode = graph.GetRuntimeNode(other.node);
            if (otherNode == null)
            {
                Debug.LogWarning(other.node.name + " node not found ||| " + other.node, this);
                port.Disconnect(i);
                continue;
            }

            Transform port2 = otherNode.GetPort(other.fieldName, other.node).transform;
            if (!port2)
            {
                Debug.LogWarning(other.fieldName + " not found", this);
            }
            connections[i].SetPosition(transform.position, port2.position);
        }
    }