Created
May 17, 2023 10:25
-
-
Save daniele-quero/578e67b3254ef13cb041dff335aafa0a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ToggleCallback : MonoBehaviour | |
{ | |
public TextMeshProUGUI label; | |
public List<Toggle> toggles; | |
void Start() | |
{ | |
string s = toggles | |
.Select(t => t) | |
.Where(t => t.isOn == true) | |
.First() | |
.name.Substring(8, 1); | |
setLabel(s); | |
} | |
public void setLabel(string s) | |
{ | |
if (toggles.All(t => !t.isOn)) | |
s = ""; | |
label.text = "Toggle selected:" + s; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment