- Home /
GUI button working with GUI Textfield
Hello again
Early this week I was asking this: http://answers.unity3d.com/questions/737859/choose-a-texture-in-game.html I have solve this and I have now a textfield but that is not working in game ( in the inspector he does it but not in game) I thing I must a button collaborate with the textfield but how?
I have A script with www inside it, The script can have a link. The link must have A picture in it. If the link is good. The picture will show on a block. But this can only via the inspector. I have add a textfield to the script but I cant change the picture via the textfield. I thing I must add a button to achieve this here is the script:
var url : String = "Hello World";
function Start () {
var www : WWW = new WWW (url);
yield www;
render.material.mainTexture = www.texture;
}
function OnGUI () {
url = GUI.TextField (Rect (10, 10, 200, 20), url, 500);
}
I dont have more.
(sorry for the bad english)
You might want to provide your code that you are using to achieve this without which we can not even speculate as to what is not working.
Also provide additional details as to what is your target platform, what you are trying to achieve, what results you are getting.
The more information that you provide will give us proper information to work with.
As I understand your question, now what you need to do is add a GUI.Button to your OnGUI(). In the code for that button apply the texture file received from the 'url' to your game object (through a material renderer).
Check some of these for more details:
Best luck!
No my thing needs a link. It can be every texture on the internet.
Your answer
Follow this Question
Related Questions
GUI Button Disappearing 1 Answer
I have doubt please help me 2 Answers
Javascript GUI.Button help, Error BCE0077 1 Answer
Text.Field erratically updating 0 Answers
textfield and button submit 1 Answer