public void updateToolRingIcons() { if (toolRing != null) { // Make the tool ring become less transparent as it eases in: float alpha = Mathf.Pow(toolRing.transform.localPosition.y / toolRingY, 2f); float scale = 0.75f + 0.25f * alpha; Vector3 scaleVec = 0.045f * (new Vector3(scale, scale, scale)); //toolRing.transform.localScale = new Vector3 (scale, scale, scale); float smallestAngleDiff = float.MaxValue; selectedToolEntry = null; foreach (Transform tf in toolRing.transform) { if (alpha > 0) { tf.gameObject.SetActive(true); float angleDiff = Mathf.Abs(-toolRing.transform.localEulerAngles.y - tf.localEulerAngles.y); angleDiff = angleDiff % 360f; // Just to make sure... if (angleDiff > 180f) { angleDiff = 360f - angleDiff; } Color col = (1f - angleDiff / 360f) * (iconColor); // Make the tool ring become less transparent as col.a *= alpha; tf.localScale = scaleVec; if (tf.GetComponent <SpriteRenderer> () != null) { tf.GetComponent <SpriteRenderer> ().color = col; } if (angleDiff < smallestAngleDiff) { smallestAngleDiff = angleDiff; selectedToolEntry = tf.GetComponent <ToolRingEntry> (); } } else { tf.gameObject.SetActive(false); } } if (selectedToolEntry != null) { Color col = Color.white; col.a *= alpha; selectedToolEntry.GetComponent <SpriteRenderer>().color = col; ActiveToolName.text = selectedToolEntry.name; } Color textCol = ActiveToolName.color; textCol.a = alpha * alpha; ActiveToolName.color = textCol; ActiveToolName.transform.localScale = scaleVec * 0.1f; } }