Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
11
Question by Rush-Rage-Games · Oct 26, 2010 at 02:41 PM · javascriptguitextflagged-for-close

Gui Text Script

Hi,

I'm doing the challenge 3 on http://www.unity3dstudent.com/2010/07/challenge-c03-beginner/ and I can't get the GUI Text to work. I what the GUI Text to go up by one number every time the ball collides with the box/target, and when you get 3 point go to the win screen. What script (Javascript) do I need for that. Thanks,

Mr.Snake

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 SisterKy · Jul 21, 2011 at 09:26 PM 2
Share

hrm... how the hell did this get 11 votes and 11 faves? 3 funky llamas and emailing scripts?... though the content is not offensive per se, I feel very much like closing this for cheating the system so ruthlessly... bumping this useless stuff to page 4 of 'most voted'... not appreciated.

Greetz, $$anonymous$$y.

avatar image funkyllama · Dec 08, 2011 at 04:03 PM 1
Share
@Sister$$anonymous$$y. To be honest i've no idea how i got 3 funkyllama's either.. $$anonymous$$y reason for emailing the project was because I couldn't attach it on here :(

4 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by funkyllama 2 · Oct 28, 2010 at 06:35 PM

Hi,

As promised I've emailed you the complete project. Sent to email found through the website link found on your profile ;)

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 Rush-Rage-Games · Oct 28, 2010 at 09:20 PM 0
Share

I got the email! Thank you for every thing!

avatar image
4

Answer by funkyllama 1 · Oct 27, 2010 at 02:06 AM

Hi Mr Snake When I next get on my dev computer I'll comment the code and send you the project ;) PS. Don't forget to vote me up :)

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

Answer by funkyllama · Oct 26, 2010 at 06:14 PM

How I done it..

Created a script named score.js with the following code:

static var Score : int = 0;

function Update () { this.text = "Score:" + Score.ToString(); if(Score == 3) { Application.LoadLevel("youwin") } }

I attached this script to the GUItext object that displayed the score.

Then in the script that catches collision with the box I put

score.Score += 1;

Hope this helps ;)

Comment
Add comment · Show 3 · 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 Rush-Rage-Games · Oct 26, 2010 at 08:20 PM 0
Share

Sorry, I am the noob of all noobs. I'm not sure what the "script that catches collision with the box" is supposed to look like, could you include the hole script? Thanks!

avatar image · Oct 28, 2010 at 11:44 PM 1
Share

The other 3 answers really were unnecessary...

avatar image Amir Ebrahimi · Nov 01, 2010 at 10:05 PM 1
Share

@$$anonymous$$rSnake. You would increment the score in the collision event:

function OnCollisionEnter(collision : Collision) { score.Score += 1; }

http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$onoBehaviour.OnCollisionEnter.html

avatar image
2

Answer by funkyllama · Oct 27, 2010 at 02:08 AM

Hi Mr Snake When I next get on my dev computer I'll comment the code and send you the project ;) PS. Don't forget to vote me up :)

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

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

2 People are following this question.

avatar image avatar image

Related Questions

What's wrong with my function? It keeps telling me 'loseText' is not a member of 'UnityEngine.GUIText'. Please help, please and thank you! 0 Answers

Create GUIText from Javascript 3 Answers

How to change the text on an other object ? 2 Answers

How to make GUI Text appear after a certain amount of time 2 Answers

Changing 3d text through script 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