//Create a telemetry notification object and add it to the details panel at the given index //Index 0 is at the top of the panel void CreateTelemetryNotification(TelemetryData t, int index) { GameObject panelClone = Instantiate(telemetryNotification, notificationsPanel.GetComponent <Transform>(), false); panelClone.GetComponent <RectTransform>().localPosition = new Vector3(0, (float)(2.4 - 0.95 * index), 0); //Set color based on severity switch (t.severity) { case Severity.NOMINAL: panelClone.GetComponent <Image>().color = Constants.GREEN; break; case Severity.WARNING: panelClone.GetComponent <Image>().color = Constants.YELLOW; break; case Severity.CRITICAL: panelClone.GetComponent <Image>().color = Constants.RED; break; case Severity.UNKNOWN: panelClone.GetComponent <Image>().color = Constants.RED; break; } //Set text panelClone.GetComponentInChildren <Text>().text = t.GetDescription(); }