Skip to content
Snippets Groups Projects
Commit 57840c6a authored by Tobias Schöner's avatar Tobias Schöner
Browse files

fix: WorldFactInteraction now uses CanvasGoup alpha instead of Image alpha

CanvasGroup alpha also affects child GameObjects alpha, whereas Image alpha only affects the Image itself
parent c241fce9
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment