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 ama · Jul 27, 2010 at 02:51 PM · changelevelkey

pressing key - changing scene

Hi,

i'm a bloody newbie using unity3, but advanced in 3d. currently I'm working on a kind of an art-fps-game for a performance on stage. i need to change the levels manually at a certain time, so my first idea was to use keys switching to the levels, i.e. key #2 for level 2, key #3 for level 3 and so on...

i have no idea how to solve this?

glad for any suggestions: andreas

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Thaelvyn · Jul 27, 2010 at 03:02 PM

Hi,

You could use something along those lines, using F2 and F3 keys:

function Update(){

If (Input.GetKey(KeyCode.F2)){ Application.Loadlevel("level2") } else if (Input.GetKey(KeyCode.F3)){ Application.Loadlevel("level3") }

}

Comment
Add comment · Show 9 · 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 ama · Jul 27, 2010 at 03:15 PM 0
Share

wow, thanks for that quick reply. i think i understand your codesnippet. thanks. last stupid question: where do i have to put that code to? :)

avatar image Thaelvyn · Jul 27, 2010 at 03:26 PM 0
Share

put that in a script attached to a permanent element of your scene. Or you can as well create an empty GameObject, rename it "levelChange" for example and add the script with this inside (it's Javascript). That should do the trick for you. Be sure to have that "levelChange" GameObject in all your scenes :)

avatar image HolBol · Jul 27, 2010 at 04:19 PM 0
Share

You missed a few semi colons, you need : Application.Loadlevel("level2");

avatar image ama · Jul 27, 2010 at 10:06 PM 0
Share

hi there, thank u very much for your help. so i entered this code onto an empty GameObject: function Update(){ If (Input.Get$$anonymous$$ey($$anonymous$$eyCode.F2));{Application.Loadlevel("level2");} else if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.F3)){ Application.Loadlevel("level3");} else if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.F4)){ Application.Loadlevel("level4");} else if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.F5)){ Application.Loadlevel("level5");} } but what I get is this error: Assets/NewBehaviourScript.js(3,63): BCE0044: expecting :, found ';'. what's wrong there? i think i almost got it, grr :)

avatar image Thaelvyn · Jul 28, 2010 at 04:14 AM 0
Share

I typed a bit too fast, and without spellchecking :/. The first "If" statement has an uppercase I, it should be "if". That's the only error I can see there, but bare in $$anonymous$$d that I am just waking up :)

Show more comments

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

Click Object to change scene 2 Answers

just a simple question.. 1 Answer

Is it possible to change keyboard input inGame 1 Answer

Change level after destroying all enemies? 1 Answer

Chage level Whith time 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