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 /
avatar image
0
Question by andrewjm10 · Jul 12, 2013 at 10:57 PM · errorload

Scroll text works, but load level is to fast!

I am using a script to load text on the screen and it scrolls down, wish it was up but my issue is that i added a load function at the bottom and it loads the level before it even scrolls the text.

 <code>
 
 public var intro : String[];
 public var off : float;
 public var speed = 50;
 function OnGUI()
 {
 off += Time.deltaTime * speed;
 for (var i = 0; i < intro.Length; i++)
 {
 var roff = (intro.Length*-20) + (i*20 + off);
 var alph = Mathf.Sin((roff/Screen.height)*180*Mathf.Deg2Rad);
 GUI.color = new Color(1,1,1, alph);
 GUI.Label(new Rect(650,roff,Screen.width, 30),intro[i]);
 GUI.color = new Color(1,1,1,1);
 Application.LoadLevel ("Level1"); 
 }
 }
 
 </code>

How can i get it to wait for the text to finish?

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 create3dgames · Jul 12, 2013 at 11:58 PM 0
Share

If you know how long it's going to take then you could use WaitForSeconds.

avatar image andrewjm10 · Jul 13, 2013 at 12:07 AM 0
Share

The audio clip is 12 seconds long, how do i add the waitforseconds?

avatar image create3dgames · Jul 13, 2013 at 01:06 AM 0
Share
 yield WaitForSeconds (12);

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by andrewjm10 · Jul 13, 2013 at 01:21 AM

Never mind i fixed it, thanks for the reply's it did help. Looking at links and unity wiki, i add:

 function Start (){
     audio.Play();
     yield WaitForSeconds (15);
     Application.LoadLevel ("CreateCharacter");
     }

Now it works great!

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 create3dgames · Jul 13, 2013 at 02:35 AM 0
Share

Excellent!

avatar image
-1

Answer by Slobdell · Jul 13, 2013 at 12:08 AM

Why not make them push a button to proceed to the next level

Comment
Add comment · Show 4 · 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 andrewjm10 · Jul 13, 2013 at 12:15 AM 0
Share

Because it's an into not a menu, the text scrolls down and has music playing in the background.

Or do you mean like a skip button?

avatar image Slobdell · Jul 13, 2013 at 12:24 AM 0
Share

What about checking the position of the scroll text and loading the level when it gets to a certain point? Also, the OnGui function is. called every frame so that whole for loop is completed within one frame, don't think that's what you want

avatar image andrewjm10 · Jul 13, 2013 at 12:33 AM 0
Share

Ok, thanks for the info how do i fix it? so it is not all inside the OnGui? last time i tried it was full of errors.

avatar image Slobdell · Jul 13, 2013 at 12:39 AM 0
Share

You don't want to use a loop to move something on the screen. You have to lerp it. You can check out mathf.lerp for this situation but basically you just want to have a float for its position and then change the float every frame by a little bit. Like in OnGui you could just do textPosition += Time.deltaTime * aSpeedYouLike

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

17 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

Related Questions

Multiple Cars not working 1 Answer

Unity error "scripts exist in multiple locations" 1 Answer

Networking Problem Please Help!!! [IMPORTANT] 0 Answers

Spawn Script Issue 0 Answers

Help Solve This 2 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