Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by NinjaRubberBand · Sep 03, 2016 at 06:09 PM · gameobjectkeyboardtype

Need help with typing game

I think this is the first game im making where i dont know how to start, so im asking. I do know how to script and i have been using unity for two years. But this project bugs me. I wanna make a typing game where a text appears and you need to type what it says. For example the box says "This is your first lesson" Then you need to type the sentence. When i type the first letter T the t in the box needs to become green, and so on when i type the next letter. If i press the wrong key, the letter becomes red. Hope someone can help!

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Derpybunneh · Sep 03, 2016 at 08:56 PM

(This makes sense in my head, but it might not actually work...)

I can't provide any legit code for you, but I can try my best to help you think it out.

First you probably want to store the text you want the player to type in a text UI object in a typing script or something. Then in that typing script you should get the number of characters in your line of text and store it in an integer. Then you'd probably want to create an int called characterBeingTyped that will keep track of the current int your on of the overall characters in your line of text. For example, if I have a text 5 letters long, and I'm supposed to type the first letter, then characterBeingTyped would be 0. Next, you should store each character of your word in a characters array.

Next, you'd probably want a for or while loop that will loop through the characters you want to type as long as they are less than the number of characters in the text int.

(This code will not actually work, it's just some pseudo code) `

 for (characterToType = 0; characterToType < textCharacters; characterToType++) {
         if (Input.anyKeyDown) {
             // Get key that was pressed down
             if (keyThatWasPressedDown == characters[characterToType]) {
                 // Make character green... somehow
             } else {
                 // Make character red... somehow
             }
         }
     }

Sorry I can't do much to help answer your question! But that might be able to get you started with the general idea.

Comment
Add comment · Show 1 · Share
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 NinjaRubberBand · Sep 06, 2016 at 02:08 PM 0
Share

Thank u, i will try making it work!

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.

Follow this Question

Answers Answers and Comments

67 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 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 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 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 avatar image avatar image avatar image

Related Questions

Determine if game object is tyoepf One Prefab 3 Answers

How to get the type of a Gameobject 3 Answers

using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers

What is the type of my prefab? 2 Answers

UI button keyboard input into typing game ,UI button keyboard to input to Typing Game 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges