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 diarafbi · May 08, 2015 at 05:58 AM · javascriptunity 4.6

input.getkey and loadlevel won't run

i have 3 scene 1.main menu 2.about (with button to camera) 3.some scene use camera device named (CameraPart) all of 3 scene have this script

 using UnityEngine; 
 using System.Collections; 
 public class ScriptName : MonoBehaviour { 
 
 public void Update () 
 {
 if (Input.GetKey (KeyCode.Escape)) { 
 Application.LoadLevel("previous scene");
  } 
 
 } 
 }

exept the main menu scene, main menu scene use this script

 using UnityEngine; 
 using System.Collections; 
 public class ScriptName : MonoBehaviour { 
 public void Update () { 
 
 if (Input.GetKey (KeyCode.Escape)) 
 {
  Application.Quit (); 
 } 
 } 
 } 

when I was in the "about" scene I can get back on the main scene menu properly, but when I've arrived at the scene "camera", when I try to hit the back button. application is not returned to the scene about, and even exit the aplication any ideas?

Comment
Add comment · Show 1
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 diarafbi · May 08, 2015 at 08:44 PM 0
Share

i've done with that, scene 2 to scene 1 work correctly, but scene 3 to scene 2 wont run. do i have to add more than 1 scene for the same scene?, for exemple i have to add scene 2 twice?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by directusgames · May 08, 2015 at 01:22 PM

I would first start off by adding each scene into the build settings for unity, if you haven't already:

  1. Select scene

  2. On the toolbar, click "File"

  3. Click "Build Settings"

  4. Click "Add Current" underneath the "Scenes In Build" space.

  5. Repeat steps 1 - 4 for each scene.

Note: You are best off adding them in the order you want them to progress (add Scene 1 first, then Scene 2, then Scene 3.)

Now assuming that I understand your scene flow correctly:

Scene 1 -> Scene 2 -> Scene 3

Your code for Scene 1 is correct.

Then for Scene 2 change your LoadLevel statement to:

 Application.LoadLevel(0); //Index 0 is Scene 1

or

 Application.LoadLevel("Scene1Name");

And Scene 3 should be:

 Application.LoadLevel(1); //Index 1 is Scene 2

or

 Application.LoadLevel("Scene2Name");

I haven't tested this but that should work.

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 diarafbi · May 08, 2015 at 02:59 PM 0
Share

scene 3 to scene 2 not work why?

avatar image directusgames · May 08, 2015 at 07:49 PM 0
Share

Can I see your code? Are you receiving an error at all?

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

FPS using mouse to move rather than keys 1 Answer

gameobject.SetActive(false) issue in Stand-Alone build 1 Answer

How to send a raycast to an object to give me ammo? 0 Answers

Simple car script not work on unity 5? 1 Answer

Saving data to xml file (I have the loading down) 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