How do I make buttons that turn into a text field? (35902)

How do I make buttons that turn into a text field?

I want it so the user sees buttons on the screen and when clicked they turn into a text field that has several lines of text. With the option of closing the field which then reverts back to a button ready to be clicked again.

Please help this unity nub!

2 Answers

2

private var foldOut = false;

function OnGUI(){
    if(!foldOut){
        if(GUI.Button(blah,blah,blah,blah,blah)){ //Press and it will "fold out"
            foldOut = true;
        }
    }else
        GUI.TextField(Blah,blah,blah,blah,blah);
        if(GUI.Button(blah,blah,blah,blah,blah)){ // Press again and it will "fold in"
        foldOut = false;
    }
}

Simple example for you, nothing special. Hopefully you will get the idea.

That doesn’t work Lightning it says blah is an unknown identifier.

Please don't post comments to someone's else's Answer as an Answer to your Question. This is not a Forum, even though it looks like one (We all hate Qato for not fixing the Userinterface).

Better still, please don't post the [SAME QUESTION][1] twice, in the hope that you'll get different answers! If you can't understand Lightning's answer, you need to learn more about coding. 'Blah' is obviously a nonsense word that stands in for what you would actually put there. [1]: http://answers.unity3d.com/questions/214222/how-do-i-make-buttons-that-turn-into-a-text-field.html