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 xmediagrafx · Oct 18, 2011 at 07:51 PM · ontriggerenterguitextcountdownapplication.loadlevel

OnTriggerEnter to load Level and display message help...

Hello guys,

I am using OnTriggerEnter to load next level as player enters an area, what i am having trouble with is displaying text on screen to alert player that next level is loading...Can you help??

 function OnTriggerEnter (col : Collider) {
     print("Loading Next Level");
     yield WaitForSeconds (5);
     Application.LoadLevel (3);
 }
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 xmediagrafx · Oct 18, 2011 at 08:37 PM 0
Share

shouldn't this at least display the text "Loading Next Level" on screen? Or is the WaitForSeconds delaying everything including the text? Countdown isn't as important, just need it to at least put text on screen to inform player that level is loading, but "print" or "guiText" not working....

avatar image BogdanC · Oct 19, 2011 at 12:37 PM 0
Share

this won't display the text on screen but rahter in the console.Use a GUI text or something

2 Replies

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

Answer by Sun_Glasses_Guy · Oct 18, 2011 at 11:12 PM

You could just make a level load that's just a loading screen, with 3dText centered on the camera while the actual level loads. //At the top of the Screen: GameObject -> Create New -> 3dText(Gui Text might also work)

and then have THAT loading screen load your next level! Then you could throw in a cool splashscreen while the next level loads, although to be honest, if I ever had to load a unity level for more than a few seconds it's usually too choppy to even play

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 xmediagrafx · Oct 19, 2011 at 12:41 AM 0
Share

I was thinking this as well, but would still like to learn how to trigger GUI with OnTriggerEnter...

Thanks!

avatar image
0

Answer by xmediagrafx · Oct 19, 2011 at 12:33 PM

From Unity 3d forum - create a small game object, with a script attached, that sets DontDestroyOnLoad in its awake function. This game object displays your text for "please wait, loading..." and then after a few seconds, and definitely after the level has loaded, the game object destroys itself.

Code:

 function OnTriggerEnter(col : Collider)
 {
 GameObject.Instantiate(yourLoadingGameObject, Vector3.zero, Quaternion.identity);
 Application.LoadLevel(3);
 }


Then stick this script on whatever object you want to instantiate just before you load your level. Code:

 public class LoadingMessage : MonoBehaviour
 {
     void OnLevelWasLoaded(int level)
     {
         Destroy(this.gameObject, 3.0f);
     }
 
     void Awake()
     {
         DontDestroyOnLoad(this.gameObject);
     }
 
     void OnGUI()
     {
         GUI.Label(new Rect(50, 50, 200, 25), "Loading next level...");
     }
 
 }
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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Timer not work :( 0 Answers

How to display a characters "dialogue" when entering a collider? 1 Answer

Destroy a specific object on trigger? 1 Answer

Enable ChildObject of Player with OnTriggerEnter? Or a whole different method? 0 Answers

LoadLevel help! 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