void RestorePosition()
        {
            if (dragHandler == null)
            {
                dragHandler = GetComponent <GMDraggableObject>();
            }

            if (dragHandler != null)
            {
                if (PlayerPrefs.HasKey("DevelopmentConsole_PositionX") && PlayerPrefs.HasKey("DevelopmentConsole_PositionY"))
                {
                    Vector2 restoredPosition = new Vector2(PlayerPrefs.GetFloat("DevelopmentConsole_PositionX"), PlayerPrefs.GetFloat("DevelopmentConsole_PositionY"));
                    dragHandler.SetTargetPosition(restoredPosition);
                }
                else
                {
                    dragHandler.SetTargetPosition(Vector2.zero);
                }
            }
        }
示例#2
0
 private void OnDisable()
 {
     cachedSize = rectTransform.sizeDelta;
     draggableObject.SetTargetPosition(new Vector2(draggableObject.target.anchoredPosition.x + rectTransform.sizeDelta.x, draggableObject.target.anchoredPosition.y));
 }