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 kevinspawner · Aug 18, 2014 at 09:42 AM · cameraui

Pause Button Brings down a menu options! help needed!

When pause button is touched it need to brings down the menu options which already has the options for Resume, Try again.

Am able to pause the game by using timescale.

  1. How to bring the menu options? Menu options are in a separate game object with animation in it.

  2. Am currently using Ray cast for touching function is it a good option? I guess if I use ray cast it will be expensive in terms of memory is there any other better way to approach it?

Code:

 {
     public RaycastHit hit;
     public Texture pauseTex;
     public Camera cam;
 
         
     void Update()
     {
         if (Input.GetKeyDown (KeyCode.Mouse0)) 
         {
             control (Input.mousePosition);
         }        
     }
 
 
     void control (Vector3 a)
     {
         Ray ray = cam.ScreenPointToRay(a);
 
         if (Physics.Raycast (ray, out hit, 20)) 
         {
 
         }
     }
 
 }

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 kevinspawner · Aug 19, 2014 at 07:00 AM 0
Share

Any help?

2 Replies

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

Answer by Kiwasi · Aug 19, 2014 at 07:20 AM

There are multiple ways to code a menu

  1. Use Unity's built in system OnGUI(). This is notorious for bad performance, and is relatively inflexible. But its pretty easy to code a menu.

  2. Build a menu using 2D sprites or GUITextures. Use OnMouseDown or raycasts to detect clicks. This is pretty much the way you are going

  3. Use a third party tool available from the asset store. I hear NGUI is pretty good, though I have never used it.

For a pause menu performance is not really a big concern. All of your big performance hitting scripts should be idle during the pause. Menus and GUI that need to operate during gameplay are where performance should be considered.

Comment
Add comment · Show 5 · 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 kevinspawner · Aug 19, 2014 at 08:27 AM 0
Share

Thanks. But am struck with this Time scale. Am not sure How to pause the game and bring the menu which has an options for resume, options and back. Also, when I use Time Scale the complete game freezes, So how can I play that $$anonymous$$enu Animation? It is frustrating as I have not came across with any solution yet!

avatar image Kiwasi · Aug 19, 2014 at 07:48 PM 0
Share

Update still runs. You can use Time.unscaledDeltaTime and a custom timer.

avatar image kevinspawner · Aug 25, 2014 at 02:57 AM 0
Share

Thanks a lot. I will give a try.

avatar image Kiwasi · Aug 25, 2014 at 03:09 AM 0
Share

Scratch that, try the new Unity 4.6 beta. Every property you want to play with can be controlled via the animator.

avatar image kevinspawner · Aug 26, 2014 at 07:40 AM 0
Share

Wow Sounds great. So even if Timescale is zero, I can able to animate particular game object?

avatar image
-1

Answer by DBar · Aug 19, 2014 at 07:11 AM

RayCast is not expensive. You need it.

Where's your menu?

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 kevinspawner · Aug 19, 2014 at 08:29 AM 0
Share

Thanks. What do you mean by menu? It is just a plain with texture.

All I need is how to instantiate the menu when I hit the pause button. I do understand that we need to use Time scale for pausing the game! But, it freezes the completed game so I cannot instantiate the menu. Any suggestion?

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

24 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

Related Questions

canvas screen space camera rotation issue 0 Answers

Galak Z like UI element 0 Answers

Stop character from moving out of camera sight 1 Answer

UI Canvas with split Camera 0 Answers

Player UI freezes when rendering to render texture. 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