• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by cocleu · Sep 13, 2013 at 01:40 PM · word

Change texture in runtime by type a word

Hello, i am just a beginer with Unity. I am working in "English for kid" project that require player input words to see things happen. For example: Player type "Tiger" in GUI, my game Object change texture to "Tiger". I know how to create a Gui, but i don't know how GUItext send command to game object (or any other method to do in my project). Thanks.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ShadoX · Sep 13, 2013 at 11:49 PM 0
Share

I guess you're using http://docs.unity3d.com/Documentation/ScriptReference/GUI.TextField.html for the textBox so http://docs.unity3d.com/Documentation/ScriptReference/GUI.Button.html should be good enough to handle the text.

Basically the first link states that if you use that code you're editing the "stringToEdit" string. So if you had a button you could use that to call some function that will handle the text input. In this case it would be a matter of checking if "stringToEdit" would be equal to "Tiger" and if it were you would change the texture (or do something else)

All that you need for that is something like..

 if(textToEdit=="Tiger"){
 //change your texture or do something else
 }

I'm not sure if changing textures wold be the best thing. Perhaps switching between gameObjects that have a certain texture.

Hope this helps.

avatar image cocleu · Sep 14, 2013 at 03:18 AM 0
Share

Thanks ShadoX i feel brighter now.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

guiText.text could this be word wrapping? 2 Answers

Show Strings With Last Characters of the first Word 1 Answer

How can I make a Button's OnClick() list shorter? 1 Answer

how to display a long string sentence by sentence instead of character by character? 1 Answer

words search game 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges