private void OnClickLoadCube(string cubeName)
    {
        DrawActionButtonMapping.ActionButtonMap selected = this.procUI.drawActionButtonMapping.actionButtonData.SingleOrDefault(x => x.Selected);

        // if we are loading a Cube to work on...
        if (selected == null)
        {
            ReferenceBuffer.Instance.worldSpaceUI.connTracker.AddBundle(cubeName);
            ReferenceBuffer.Instance.worldSpaceUI.connTracker.LoadPersistedData(cubeName, true);
        }
        // if we are mapping key to a Cube...
        else
        {
            ActionKeyPersistance.ActionKeyPersistanceData[] mappings = ActionKeyPersistance.GetKeyCubeMapping();

            if (mappings.Any(x => x.CubeName == cubeName))
            {
                Debug.Log("There is already key with that cube name!!!");
                return;
            }

            if (selected == null)
            {
                return;
            }

            selected.SetName(cubeName);
            selected.Deselect();
            ActionKeyPersistance.Persist(new ActionKeyPersistance.ActionKeyPersistanceData
            {
                CubeName = cubeName,
                KeyId    = selected.Id,
            });

            ReferenceBuffer.Instance.ShowPresetBehaviour.RedoMappingConnections();
        }
    }
    private void ActionButtonOnClick(int id)
    {
        ActionButton btnInfo = this.buttons.Single(x => x.ID == id);

        if (btnInfo.CubeName != null)
        {
            Debug.Log($"WORKS=> {btnInfo.CubeName}");

            GameObject player = ReferenceBuffer.Instance.PlayerObject;

            Vector3?droneMarker = null;
            if (ReferenceBuffer.Instance.DroneIntersection != null)
            {
                droneMarker = ReferenceBuffer.Instance.DroneIntersection.GetIntersectionPosition;
            }

            ReferenceBuffer.Instance.worldSpaceUI.connTracker.RunCube(btnInfo.CubeName, new Variable[]
            {
                new Variable
                {
                    Name  = ResultCanvas.PlayerForwardVarName,
                    Value = ReferenceBuffer.Instance.PlayerObject.transform.forward,
                },
                new Variable
                {
                    Name  = ResultCanvas.PlayerPositionVarName,
                    Value = ReferenceBuffer.Instance.PlayerObject.transform.position,
                },

                new Variable
                {
                    Name  = ResultCanvas.PlayerMarkerVarName,
                    Value = ReferenceBuffer.Instance.PlayerIntersection.GetIntersectionPosition,
                },
                new Variable
                {
                    Name  = ResultCanvas.DroneMarkerVarName,
                    Value = droneMarker,
                },
            });

            return;
        }

        CubeInfo[] infos = CubePersistance.GetAllSavedCubes();

        if (infos.Length == 0)
        {
            Debug.Log("There are no saved QUBES!!!");
            return;
        }

        string lastName = infos.Last().Name;

        var persistedKeys = ActionKeyPersistance.GetKeyCubeMapping();

        if (persistedKeys.Select(x => x.CubeName).Contains(lastName))
        {
            Debug.Log("That spell name already keyd!");
            return;
        }

        ActionKeyPersistance.Persist(new ActionKeyPersistance.ActionKeyPersistanceData
        {
            CubeName = lastName,
            KeyId    = id,
        });

        btnInfo.Button.transform.Find("Text").GetComponent <Text>().text = lastName;
    }