diff --git a/Assets/Scripts/InteractionEngine/WorldFactInteraction.cs b/Assets/Scripts/InteractionEngine/WorldFactInteraction.cs index 64d70e57e4f0c364a0cd447c8c71402646bc1a37..da67c757fa0a1a558f2463fe43f8c7d547c9e9ad 100644 --- a/Assets/Scripts/InteractionEngine/WorldFactInteraction.cs +++ b/Assets/Scripts/InteractionEngine/WorldFactInteraction.cs @@ -20,7 +20,7 @@ void LateUpdate() if (currentDisplay != null && currentDisplay.GetComponent<DragHandling>().dragged) { // currently dragging -> remove transparency to indicate dragging and let DragHandling.cs take over - ChangeImageAlpha(currentDisplay.GetComponent<Image>(), 1); + currentDisplay.GetComponent<CanvasGroup>().alpha = 1; return; } @@ -56,7 +56,7 @@ private void UpdateDisplay() } currentDisplay.transform.position = Input.mousePosition; // move currentDisplay to mousePosition - ChangeImageAlpha(currentDisplay.GetComponent<Image>(), 0.5f); // ensure that image alpha is correct, since it could have changed due to dragging + currentDisplay.GetComponent<CanvasGroup>().alpha = 0.5f; // ensure that image alpha is correct, since it could have changed due to dragging lastHit = hit.transform; } @@ -71,11 +71,6 @@ private void InstantiateNewDisplay(FactObject factObj) } #region Helper - private static void ChangeImageAlpha(Image img, float alpha) - { - img.color = new Color(img.color.r, img.color.g, img.color.b, alpha); - } - /// <summary> /// Returns true if any UI other than currentDisplay was hit /// </summary>