private void AddRepresentation(VisualProgrammingActionRepresentation representation, float xPosition)
    {
        if (linkedBot == null)
        {
            return;
        }
        float xOffset = 0;

        for (int i = 0; i < actionRepresentations.Count; i++)
        {
            xOffset += actionWidth / 2;
            if (xOffset > xPosition)
            {
                actionRepresentations.Insert(i, representation);
                xOffset = -1;
                break;
            }
            xOffset += actionWidth / 2;
            xOffset += actionSpacing;
        }
        if (xOffset > -1)
        {
            actionRepresentations.Add(representation);
        }
        UpdateDisplay();
    }
    private void RemoveAction(VisualProgrammingActionRepresentation representation)
    {
        VisualProgrammingActionRepresentation childRep;

        for (int i = representation.transform.childCount - 1; i >= 0; i--)
        {
            if ((childRep = representation.transform.GetChild(i).GetComponent <VisualProgrammingActionRepresentation>()) != null)
            {
                if (actionRepresentations.Contains(childRep))
                {
                    RemoveAction(childRep);
                }
            }
        }
        representation.parented = false;
        actionRepresentations.Remove(representation);
    }
    public void Setup(IrisBotProgrammable irisBot)
    {
        linkedBot             = irisBot;
        actionRepresentations = new List <VisualProgrammingActionRepresentation>();
        float xOffset = 0;

        foreach (var action in linkedBot.actions)
        {
            GameObject representationObject = Instantiate(action.UIRepresentation, content.transform);
            VisualProgrammingActionRepresentation representation = representationObject.AddComponent <VisualProgrammingActionRepresentation>();
            representation.Setup(action);
            representation.parented = true;
            representation.GetComponent <AnimatedUIMovement>().SetPositionImmediate(new Vector2(xOffset, 0));
            actionRepresentations.Add(representation);
            xOffset += actionWidth + actionSpacing;
        }
        UpdateDisplay();
    }