Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
2
Question by jeffdogy · Jul 04, 2017 at 01:48 AM · androidscene-switching

Back button

Creating a guide app for android. Im wondering how i would go about making a skript for the back button to the main menu.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by efeguclu · Jul 04, 2017 at 02:15 PM

You should create a button, Rename Your Main Menu as MainMenu And attach it to build settings then create a script and paste this inside it :

 public void BackButton(){
 UnityEngine.SceneManagement.SceneManager.LoadScene("MainMenu");
 }

then select button and open the inspector you'll see a button(plus) below onclick click on that then attach the script to the canvas and drag canvas inside the button onclick's object Select you script end select BackButton()

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 jeffdogy · Jul 04, 2017 at 03:51 PM 0
Share

Thank you. I mainly just needed the skript to do it. I know how to do all the button config and gamw object

avatar image HanSoloYolo · Aug 23, 2017 at 06:30 PM 0
Share

Can someone please elaborate on how to accomplish the following?

  1. If Back Button Pressed

  2. Scene$$anonymous$$anager.LoadScene("Start$$anonymous$$enu")

I cannot figure it out.

I tried

 public void Update()
     {
         if (Application.platform == RuntimePlatform.Android)
         {
             if (Input.Get$$anonymous$$eyUp($$anonymous$$eyCode.Escape))
             {
                 Scene$$anonymous$$anager.LoadScene("Start$$anonymous$$enu");
                 //quit application on return button
                 //Application.Quit();
                 return;
             }
         }
     }





[SOLVED] This code works just fine in the Build, but does not working in the Unity Editor. One must Build and Install on an Android Device and run the game outside the Editor in order to see the effects.

avatar image
1

Answer by Bunny83 · Jul 04, 2017 at 03:30 AM

Just check for the "escape" key:

 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         // do something.
     }
 }

If you would have searched before posting the question you should have found tons of similar examples.

Even when only searching here on UA you get endless results

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 jeffdogy · Jul 04, 2017 at 02:07 PM 2
Share

There is no escape key an android and i did search around for this, dont be rude.

avatar image StarArcher jeffdogy · Oct 19, 2020 at 08:32 PM 0
Share

I agree. Rudeness is unnecessary.

avatar image
0

Answer by jeffdogy · Jul 04, 2017 at 02:05 PM

There is no escape button on android...

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

133 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 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 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 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 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 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 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 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

Reloading Scene - Android/Quest 1 Answer

Change Scene by Drag 0 Answers

App crashes after launching scene with AR Core for second time. 1 Answer

Android device Back button not going back to last scene 2 Answers

unity 4.6 input, missing touches 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