// index is for list index
 static public void removeItem(int index)
 {
     objList.RemoveAt(index);
     for (int i = index; i < objList.Count; ++i)
     {
         objList[i] = new ObjWithIndex(objList[i].index - 1, objList[i].obj);
         objList[i].obj.transform.Find("Button_drag").gameObject.GetComponent <ClickAndDrag>().listIndex = i;
     }
     maxIndex--;
 }
    static public void addNewItem(GameObject obj)
    {
        ObjWithIndex item = new ObjWithIndex();

        item.obj   = obj;
        item.index = maxIndex + 1;
        obj.transform.Find("Button_drag").gameObject.GetComponent <ClickAndDrag>().listIndex = item.index - const_index_diff;
        maxIndex++;
        objList.Add(item);
    }
    // arguments are list indexes, except for the out argument which is sibling index
    static public void switchItems(int draggingIndex, int objToSwitchIndex, out int newSiblingIndex)
    {
        // switch the two objects in the list
        GameObject tempObj = objList[draggingIndex].obj;

        objList[draggingIndex]    = new ObjWithIndex(objList[draggingIndex].index, objList[objToSwitchIndex].obj);
        objList[objToSwitchIndex] = new ObjWithIndex(objList[objToSwitchIndex].index, tempObj);

        // setting the listIndex of two objects
        objList[draggingIndex].obj.transform.Find("Button_drag").gameObject.GetComponent <ClickAndDrag>().listIndex    = draggingIndex;
        objList[objToSwitchIndex].obj.transform.Find("Button_drag").gameObject.GetComponent <ClickAndDrag>().listIndex = objToSwitchIndex;

        // set the sibling index of the original objToSwitch (now listIndexed draggingIndex)
        objList[draggingIndex].obj.transform.SetSiblingIndex(objList[draggingIndex].index);
        newSiblingIndex = objList[objToSwitchIndex].index;
    }
    // Use this for initialization
    void Start()
    {
        viewStatic        = view;
        timeContentStatic = timeContent;

        objList          = new List <ObjWithIndex>();
        maxIndex         = 2;
        const_index_diff = 3;

        // column list initialization
        GameObject[] tempList = GameObject.FindGameObjectsWithTag("reorderable");
        for (int i = 0; i < tempList.Length; ++i)
        {
            ObjWithIndex item = new ObjWithIndex();
            item.obj   = tempList[i];
            item.index = maxIndex + 1;
            item.obj.transform.Find("Button_drag").gameObject.GetComponent <ClickAndDrag>().listIndex = i;
            objList.Add(item);
            maxIndex++;
        }

        displaySavedContentAndGetSavedOpenTime();
    }