x


varible options

hi i dont suppose anyone knows how or where i can get some information on making a options menu in unity for the varible i creat in a script...

so u click on it and u will have three different words which all do something cheers

more ▼

asked May 28 '12 at 01:36 AM

reptilebeats gravatar image

reptilebeats
1.2k 53 106 137

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

doesnt matter i sussed it out here is my code for others in java

public enum list
{
first,
second,
third,
}
var Option : list = list.first;
more ▼

answered May 28 '12 at 01:56 AM

reptilebeats gravatar image

reptilebeats
1.2k 53 106 137

...Javascript? I have not seen anything in Unity done in Java

May 28 '12 at 02:04 AM You!

what do u mean u havent seen anything in java, i only use java for game stuff and csharp for components.

May 28 '12 at 02:17 AM reptilebeats
(comments are locked)
10|3000 characters needed characters left

This is definitely something targeted for a GUI. It could look something like this (Javascript):

var onstate : int = 0; //Initial state which needs to be changed elsewhere
var text1 : String;
var text2 : String;
var text3 : String;
var buttonwidth : int;
var buttonheight : int;
var xposition : int;
var yposition1 : int;
var yposition2 : int;
var yposition3 : int;

function OnGUI () {
   if (onstate == 1){
      if (GUI.Button(Rect(xposition,yposition1,buttonwidth,buttonheight),text1)) {
         // Do stuff here.
         }
      if (GUI.Button(Rect(xposition,yposition2,buttonwidth,buttonheight),text2)) {
         // Do stuff here.
         }
      if (GUI.Button(Rect(xposition,yposition3,buttonwidth,buttonheight),text2)) {
         // Do stuff here.
         }
   else if (onstate == 2){
      // You can create another similar menu here!
   }
}
more ▼

answered May 28 '12 at 02:03 AM

You! gravatar image

You!
447 8 14 16

oh no i just wanted something for personal use so that i could make one script which adds a component after a certain amount of time to an object. and then reuse this script on many objects with different options.

i could make an editor component to do this but will get messy when more levels are created

May 28 '12 at 02:19 AM reptilebeats
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x109

asked: May 28 '12 at 01:36 AM

Seen: 184 times

Last Updated: May 28 '12 at 02:19 AM