// Init function for launching the playercontroller in the map editor.
    public void InitEditMode()
    {
        mat_index     = 0;
        editState     = CurrentEditMode.NO_OBJ;
        levelRef      = FindObjectOfType <MapEditorLevel>();
        mapManagerRef = levelRef.GetComponent <MapEditorManager>();
        SetCameraRails();

        this.enabled = true;
    }
    // Update function for the MapEditor
    private void UpdateEditMode()
    {
        if (scrollDelta != 0)
        {
            MapEditorScrollInput();
        }
        else if (Input.GetKeyUp(KeyCode.Q))
        {
            MapEditorRotateInput(1);
        }
        else if (Input.GetKeyUp(KeyCode.E))
        {
            MapEditorRotateInput(-1);
        }
        else if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            editState = CurrentEditMode.TILE;
            if (preview != null)
            {
                Destroy(preview);
            }

            //preview = Instantiate(mapManagerRef.tilePalette[tile_index]).gameObject;
            //isHoldingObject = true;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            editState = CurrentEditMode.TILEMAT;
            if (preview != null)
            {
                Destroy(preview);
            }

            //isHoldingObject = false;
        }
        else
        {
            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                editState = CurrentEditMode.PROP;
                if (preview != null)
                {
                    Destroy(preview);
                }

                //preview = Instantiate(mapManagerRef.propPalette[prop_index]).gameObject;
                //preview.GetComponent<Prop>().isPreviewObject = true;
                //isHoldingObject = true;
            }
        }

        scrollDelta = Input.mouseScrollDelta.y;
    }