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
0
Question by justcallmeapple · Feb 22, 2015 at 11:29 PM · guitextcanvasdelaydisplay

Need Text to Display After 5 Seconds

Hi,

I am at a very beginner level of scripting. I simply want to make some text that I have written in Canvas>Text, pop up on the screen after 5 seconds. I then want the text to stay on the screen after 5 seconds. (It will pop on the screen at 5s, and leave at 10s.

Please remember once again that I have minimal experience with scripting, so if you rewrite my code, could you please write it from beginning to end. Thank you so much for any help!

p.s I'm using Unity 4.6

 #pragma strict
 
 private var ShowlLabel : boolean = true;
 
 function Start() {
     yield WaitForSeconds (5);
     ShowlLabel = true;
 }
 
 function OnGUI(){
     if (ShowlLabel)
     GUI.Label(new Rect(16, -103, 115, 19), "This headache is killing me, and I'm so tired that I can barely keep my eyes open!");
 }
Comment
Add comment · Show 3
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 karljj1 · Feb 22, 2015 at 11:32 PM 0
Share

Are you using a Canvas with Text? Using GUI.Label is something else, its part of the old UI system not the new canvas system. Your code should work except your y value is $$anonymous$$us so its actually of the screen. $$anonymous$$ake it 103 not -103 and your width/height should probably be larger as 115,19 will truncate the string.

 GUI.Label(new Rect(16, 103, 500, 19), "This headache is killing me, and I'm so tired that I can barely keep my eyes open!");
avatar image justcallmeapple · Feb 22, 2015 at 11:35 PM 0
Share

Yes, I'm using the canvas with text. So what would I put in place of GUI.Label?

avatar image Fattie · Feb 23, 2015 at 06:01 AM 0
Share

use "Invoke()"

1 Reply

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

Answer by karljj1 · Feb 22, 2015 at 11:40 PM

 #pragma strict
 
 public var myText : GameObject; // Assign the text to this in the inspector
 
 function Start() {
     yield WaitForSeconds (5);
     myText.SetActive( true ); // Enable the text so it shows
     yield WaitForSeconds (5);
     myText.SetActive( false ); // Disable the text so it is hidden
 }
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 justcallmeapple · Feb 22, 2015 at 11:51 PM 0
Share

Thank you!

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Display GUI Text after delay ? 1 Answer

Problem Displaying Score on GUI text 0 Answers

TMPro text does not display correctly in Game View 3 Answers

Canvas Text gets garbled 0 Answers

How to display EULA from Doc in Unity? 0 Answers


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