How to implement radio buttons in Unity2D C# GUI?How do I calculate someone's age in C#?How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?C# Interfaces. Implicit implementation versus Explicit implementationHow to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How do I update the GUI from another thread?How to loop through all enum values in C#?How to determine if a type implements an interface with C# reflectionWhy not inherit from List<T>?
1960's book about a plague that kills all white people
Would Slavery Reparations be considered Bills of Attainder and hence Illegal?
What is the intuition behind short exact sequences of groups; in particular, what is the intuition behind group extensions?
When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?
Will google still index a page if I use a $_SESSION variable?
CEO ridiculed me with gay jokes and grabbed me and wouldn't let go - now getting pushed out of company
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
What's the difference between 'rename' and 'mv'?
Facing a paradox: Earnshaw's theorem in one dimension
What's the point of deactivating Num Lock on login screens?
Why doesn't H₄O²⁺ exist?
Could gravitational lensing be used to protect a spaceship from a laser?
What reasons are there for a Capitalist to oppose a 100% inheritance tax?
Can a virus destroy the BIOS of a modern computer?
How do conventional missiles fly?
Western buddy movie with a supernatural twist where a woman turns into an eagle at the end
Does a druid starting with a bow start with no arrows?
Is "remove commented out code" correct English?
Is there a hemisphere-neutral way of specifying a season?
Why is consensus so controversial in Britain?
Should I tell management that I intend to leave due to bad software development practices?
Forgetting the musical notes while performing in concert
Why can't we play rap on piano?
Assassin's bullet with mercury
How to implement radio buttons in Unity2D C# GUI?
How do I calculate someone's age in C#?How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?C# Interfaces. Implicit implementation versus Explicit implementationHow to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How do I update the GUI from another thread?How to loop through all enum values in C#?How to determine if a type implements an interface with C# reflectionWhy not inherit from List<T>?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm trying to find a simple solution to implement radio buttons (and detect which has been clicked) in Unity2D GUI using C#. My research has turned up many many solutions, but all for WinForms, MatLab, Rails, JAVA or some other platform. The Unity documentation shows a thing called a "ToggleGroup" but I can't seem to find any examples that show how to code it.
I'm a rookie coder, but it seems to me this should be a standard thing with tons of examples floating around. Why can't I find a single example?
c#
|
show 1 more comment
I'm trying to find a simple solution to implement radio buttons (and detect which has been clicked) in Unity2D GUI using C#. My research has turned up many many solutions, but all for WinForms, MatLab, Rails, JAVA or some other platform. The Unity documentation shows a thing called a "ToggleGroup" but I can't seem to find any examples that show how to code it.
I'm a rookie coder, but it seems to me this should be a standard thing with tons of examples floating around. Why can't I find a single example?
c#
Why would you want to code it? It is already built-in with as you mentioned toggle groups. Not sure why there would be tons of examples showing how to use it when the documentation for it is pretty in-depth. docs.unity3d.com/Manual/script-ToggleGroup.html What else do you need?
– Eddge
Mar 9 at 4:37
I'm glad you feel that documentation is "in depth". However it is fairly meaningless to the beginner. There is not a single example of the correct syntax, how to extract the button selected, or anything else useful that I can find.
– Martian
Mar 9 at 15:46
I should also mention the toggle group has to be set up at runtime, so I don't really have access to the inspector. If I set up a prefab, how do I access it after I instantiate? (So I can use it and then later destroy it) Again, a subject mentioned in the docs but not elaborated enough to allow a beginner to do it.
– Martian
Mar 9 at 15:50
did you bother to look at the scripting API? docs.unity3d.com/ScriptReference/UI.ToggleGroup.htmlActiveToggles Returns the toggles in this group that are active.
RegisterToggle Register a toggle with the group.
Tip, on the Unity documentation there is a Manual link and a Scripting API link, if you want to know how to do stuff in the editor, Manual is a good palce to look. If you need scripting help click thescripting API
link. (Googling "toggle group unity" brings it up as the second link, first link being to the manual)
– Eddge
Mar 10 at 0:43
I freely admit that I don't know how to use the docs. But when I search thru the scripting API reference, it doesn't actually show any examples. It just sends me back to the manual page listing the methods, etc.
– Martian
Mar 10 at 2:31
|
show 1 more comment
I'm trying to find a simple solution to implement radio buttons (and detect which has been clicked) in Unity2D GUI using C#. My research has turned up many many solutions, but all for WinForms, MatLab, Rails, JAVA or some other platform. The Unity documentation shows a thing called a "ToggleGroup" but I can't seem to find any examples that show how to code it.
I'm a rookie coder, but it seems to me this should be a standard thing with tons of examples floating around. Why can't I find a single example?
c#
I'm trying to find a simple solution to implement radio buttons (and detect which has been clicked) in Unity2D GUI using C#. My research has turned up many many solutions, but all for WinForms, MatLab, Rails, JAVA or some other platform. The Unity documentation shows a thing called a "ToggleGroup" but I can't seem to find any examples that show how to code it.
I'm a rookie coder, but it seems to me this should be a standard thing with tons of examples floating around. Why can't I find a single example?
c#
c#
asked Mar 8 at 23:46
MartianMartian
63
63
Why would you want to code it? It is already built-in with as you mentioned toggle groups. Not sure why there would be tons of examples showing how to use it when the documentation for it is pretty in-depth. docs.unity3d.com/Manual/script-ToggleGroup.html What else do you need?
– Eddge
Mar 9 at 4:37
I'm glad you feel that documentation is "in depth". However it is fairly meaningless to the beginner. There is not a single example of the correct syntax, how to extract the button selected, or anything else useful that I can find.
– Martian
Mar 9 at 15:46
I should also mention the toggle group has to be set up at runtime, so I don't really have access to the inspector. If I set up a prefab, how do I access it after I instantiate? (So I can use it and then later destroy it) Again, a subject mentioned in the docs but not elaborated enough to allow a beginner to do it.
– Martian
Mar 9 at 15:50
did you bother to look at the scripting API? docs.unity3d.com/ScriptReference/UI.ToggleGroup.htmlActiveToggles Returns the toggles in this group that are active.
RegisterToggle Register a toggle with the group.
Tip, on the Unity documentation there is a Manual link and a Scripting API link, if you want to know how to do stuff in the editor, Manual is a good palce to look. If you need scripting help click thescripting API
link. (Googling "toggle group unity" brings it up as the second link, first link being to the manual)
– Eddge
Mar 10 at 0:43
I freely admit that I don't know how to use the docs. But when I search thru the scripting API reference, it doesn't actually show any examples. It just sends me back to the manual page listing the methods, etc.
– Martian
Mar 10 at 2:31
|
show 1 more comment
Why would you want to code it? It is already built-in with as you mentioned toggle groups. Not sure why there would be tons of examples showing how to use it when the documentation for it is pretty in-depth. docs.unity3d.com/Manual/script-ToggleGroup.html What else do you need?
– Eddge
Mar 9 at 4:37
I'm glad you feel that documentation is "in depth". However it is fairly meaningless to the beginner. There is not a single example of the correct syntax, how to extract the button selected, or anything else useful that I can find.
– Martian
Mar 9 at 15:46
I should also mention the toggle group has to be set up at runtime, so I don't really have access to the inspector. If I set up a prefab, how do I access it after I instantiate? (So I can use it and then later destroy it) Again, a subject mentioned in the docs but not elaborated enough to allow a beginner to do it.
– Martian
Mar 9 at 15:50
did you bother to look at the scripting API? docs.unity3d.com/ScriptReference/UI.ToggleGroup.htmlActiveToggles Returns the toggles in this group that are active.
RegisterToggle Register a toggle with the group.
Tip, on the Unity documentation there is a Manual link and a Scripting API link, if you want to know how to do stuff in the editor, Manual is a good palce to look. If you need scripting help click thescripting API
link. (Googling "toggle group unity" brings it up as the second link, first link being to the manual)
– Eddge
Mar 10 at 0:43
I freely admit that I don't know how to use the docs. But when I search thru the scripting API reference, it doesn't actually show any examples. It just sends me back to the manual page listing the methods, etc.
– Martian
Mar 10 at 2:31
Why would you want to code it? It is already built-in with as you mentioned toggle groups. Not sure why there would be tons of examples showing how to use it when the documentation for it is pretty in-depth. docs.unity3d.com/Manual/script-ToggleGroup.html What else do you need?
– Eddge
Mar 9 at 4:37
Why would you want to code it? It is already built-in with as you mentioned toggle groups. Not sure why there would be tons of examples showing how to use it when the documentation for it is pretty in-depth. docs.unity3d.com/Manual/script-ToggleGroup.html What else do you need?
– Eddge
Mar 9 at 4:37
I'm glad you feel that documentation is "in depth". However it is fairly meaningless to the beginner. There is not a single example of the correct syntax, how to extract the button selected, or anything else useful that I can find.
– Martian
Mar 9 at 15:46
I'm glad you feel that documentation is "in depth". However it is fairly meaningless to the beginner. There is not a single example of the correct syntax, how to extract the button selected, or anything else useful that I can find.
– Martian
Mar 9 at 15:46
I should also mention the toggle group has to be set up at runtime, so I don't really have access to the inspector. If I set up a prefab, how do I access it after I instantiate? (So I can use it and then later destroy it) Again, a subject mentioned in the docs but not elaborated enough to allow a beginner to do it.
– Martian
Mar 9 at 15:50
I should also mention the toggle group has to be set up at runtime, so I don't really have access to the inspector. If I set up a prefab, how do I access it after I instantiate? (So I can use it and then later destroy it) Again, a subject mentioned in the docs but not elaborated enough to allow a beginner to do it.
– Martian
Mar 9 at 15:50
did you bother to look at the scripting API? docs.unity3d.com/ScriptReference/UI.ToggleGroup.html
ActiveToggles Returns the toggles in this group that are active.
RegisterToggle Register a toggle with the group.
Tip, on the Unity documentation there is a Manual link and a Scripting API link, if you want to know how to do stuff in the editor, Manual is a good palce to look. If you need scripting help click the scripting API
link. (Googling "toggle group unity" brings it up as the second link, first link being to the manual)– Eddge
Mar 10 at 0:43
did you bother to look at the scripting API? docs.unity3d.com/ScriptReference/UI.ToggleGroup.html
ActiveToggles Returns the toggles in this group that are active.
RegisterToggle Register a toggle with the group.
Tip, on the Unity documentation there is a Manual link and a Scripting API link, if you want to know how to do stuff in the editor, Manual is a good palce to look. If you need scripting help click the scripting API
link. (Googling "toggle group unity" brings it up as the second link, first link being to the manual)– Eddge
Mar 10 at 0:43
I freely admit that I don't know how to use the docs. But when I search thru the scripting API reference, it doesn't actually show any examples. It just sends me back to the manual page listing the methods, etc.
– Martian
Mar 10 at 2:31
I freely admit that I don't know how to use the docs. But when I search thru the scripting API reference, it doesn't actually show any examples. It just sends me back to the manual page listing the methods, etc.
– Martian
Mar 10 at 2:31
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072536%2fhow-to-implement-radio-buttons-in-unity2d-c-sharp-gui%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55072536%2fhow-to-implement-radio-buttons-in-unity2d-c-sharp-gui%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why would you want to code it? It is already built-in with as you mentioned toggle groups. Not sure why there would be tons of examples showing how to use it when the documentation for it is pretty in-depth. docs.unity3d.com/Manual/script-ToggleGroup.html What else do you need?
– Eddge
Mar 9 at 4:37
I'm glad you feel that documentation is "in depth". However it is fairly meaningless to the beginner. There is not a single example of the correct syntax, how to extract the button selected, or anything else useful that I can find.
– Martian
Mar 9 at 15:46
I should also mention the toggle group has to be set up at runtime, so I don't really have access to the inspector. If I set up a prefab, how do I access it after I instantiate? (So I can use it and then later destroy it) Again, a subject mentioned in the docs but not elaborated enough to allow a beginner to do it.
– Martian
Mar 9 at 15:50
did you bother to look at the scripting API? docs.unity3d.com/ScriptReference/UI.ToggleGroup.html
ActiveToggles Returns the toggles in this group that are active.
RegisterToggle Register a toggle with the group.
Tip, on the Unity documentation there is a Manual link and a Scripting API link, if you want to know how to do stuff in the editor, Manual is a good palce to look. If you need scripting help click thescripting API
link. (Googling "toggle group unity" brings it up as the second link, first link being to the manual)– Eddge
Mar 10 at 0:43
I freely admit that I don't know how to use the docs. But when I search thru the scripting API reference, it doesn't actually show any examples. It just sends me back to the manual page listing the methods, etc.
– Martian
Mar 10 at 2:31