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 MetaliZeR · Sep 18, 2010 at 12:41 PM · scenescene-loadingmusictimed

Can I switch scene on a specific time?

Hi! =)

I'm new to this program and wondering if I can switch from one scene to another on a specific time, like after 4-5sec and how do i do it? What scripts do I use and so on.

__

And in these kinds of cases can i make it switch when a song has played for some seconds?

(Ps:) Or even better: Can I switch picture after a few sec on my plane or texture?

Thanks alot.

Using Unity2.6(Not Pro)

I like this program alot and want to continue useing it :)

First time ever I making a game so i appreciate all help i can get :)

Sorry if my English is bad... :(

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

2 Replies

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

Answer by spinaljack · Sep 18, 2010 at 02:34 PM

Thems a lot of questions for one post...

To do something after a song has finished playing:

var changeLevelFlag : boolean;

function Update(){ if(!audio.isPlaying && changeLevelFlag){ // do something when the audio isn't playing // like change scenes after a tune } }

To cause a function to yield control for a few seconds (minimum 1 frame):

function SomeFunction(){ print("Current Time is " + Time.time);

yield WaitForSeconds(3);

print("Current Time is " + Time.time); }

To use a time stamp to make something happen some time after an event:

var timeStamp : float; var buttonFlag : boolean;

function PushButton(){ timeStamp = Time.time; buttonFlag = true; }

function Update(){ if(buttonFlag && Time.time-timeStamp > 3){ // do something 3 seconds after PushButton } }

There are many more examples but you should take a look at some game tutorials to practice your general coding knowledge.

EDIT:

Using your example:

function Start(){ audio.Play(); }

function Update(){ if(!audio.isPlaying){ Application.LoadLevel(1); } }

Comment
Add comment · Show 2 · 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 MetaliZeR · Sep 19, 2010 at 06:25 PM 0
Share

Ok thanks ;) Sorry for the new "answers" :)

avatar image MetaliZeR · Sep 19, 2010 at 10:54 PM 0
Share

Yes! It worked :) Thanks again.

avatar image
0

Answer by MetaliZeR · Sep 19, 2010 at 11:17 AM

Ok, when i use the script it loads my second scene immediately and just skips my first one... What am I doing wrong with the script? I want it to load scene2 when the song in scene1 is complete. Where do i put this script->

// Loads the level with index 0
Application.LoadLevel (2);

In this script-> to make it load scene2 when song is completed?

var changeLevelFlag : boolean;

function Update(){ if(!audio.isPlaying && changeLevelFlag){ // do something when the audio isn't playing // like change scenes after a tune } }

Thanks Again.

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 spinaljack · Sep 19, 2010 at 03:50 PM 0
Share

use comments, don't post answers

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

No one has followed this question yet.

Related Questions

Cannot close/unload a scene that is open in editor during playmode (using C# code)? 3 Answers

Add Menu to Unity Roguelike Example 0 Answers

UnloadSceneAsync() does not seem to work with additive scenes. 1 Answer

Access loading screen scene components from Main Menu? 1 Answer

Particular scene loads fine in the Unity Editor, but unable to load in the executable? 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