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 S_Byrnes · Mar 16, 2014 at 06:45 AM · gameobjectspausehide

How To Hide Game Objects That Aren't In Pause Script

Hey guys, I need to hide my touch buttons for an android phone when the game is paused, I have a pause script fully functional with menus but when the gui comes up the game buttons can still be pressed, which allows the player to accelerate to maximum speed or turn left and right even while paused

Does anyone know how I can hide 5 objects when paused and make them re-appear when not?

I was thinking of using tags, I've seen it done in JS, but I use C#

Thanks in advanced!

Comment
Add comment · Show 2
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 Fornoreason1000 · Mar 16, 2014 at 07:19 AM 0
Share

wait are you trying to hide GUI or objects that are interactive? With GUI just stop calling them in OnGUI, for interactive objects, disable all their scripts or at least limit their functions globally.

avatar image S_Byrnes · Mar 16, 2014 at 07:27 AM 0
Share

Objects that are interactive.

I have my touch buttons as interactive objects and when one of those objects are pushed (the pause button) the GUI will pop up.

I want the interactive objects to then disappear at that same moment.

Ok, how would I disable them like that?

1 Reply

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

Answer by BobbyDoogle · Mar 16, 2014 at 07:27 AM

I think there are multiple ways to accomplish this. I implemented a pause system in a 3d game via C# recently and got good results with

if (paused) {Time.timeScale=0;}

Then set Time.timeScale back to 1 when you leave pause.

Another approach would be in the scripts that allow control, reference your pause script and disable them when paused via their individual scripts.

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 S_Byrnes · Mar 16, 2014 at 07:40 AM 0
Share

The second approach seams like what I need to do, how could I achieve that?

avatar image Fornoreason1000 · Mar 16, 2014 at 07:47 AM 0
Share

by making a reference to those scripts from your pause script , then disabling them in code. references can be made by using the Gameobject.Find("myObjectName"); and gameobject.GetComponent("myScriptnameThatisntthepausescript") as myScriptnameThatisntthepausescript; type methods.

after that the control structure is something like this.

 if(PauseScript.paused) {
 render.enalbed = false;
 RuntouchFunction = false;  //the bool that switches your touch functions
 
 
 }

each of your script will check if its the game is paused after anyof them are clicked or if you want on Update.

avatar image S_Byrnes · Mar 16, 2014 at 07:49 AM 0
Share

Do you know the codes for that? or is the first part done in the inspector?

avatar image S_Byrnes · Mar 16, 2014 at 08:24 AM 0
Share

Alright I'll try that and let you know how I go

avatar image S_Byrnes · Mar 16, 2014 at 09:18 AM 0
Share

Hey where do these go?: Gameobject.Find("myObjectName"); and gameobject.GetComponent("myScriptnameThatisntthepausescript")

like, above the start();, in the update();.. where?

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

22 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

Related Questions

How to Hide the GUI when time.scale = 1 again 1 Answer

Pause menu script, mouse not hiding 1 Answer

Pause Menu Problem 1 Answer

NGUI panel wont hide 2 Answers

hide child object script - help 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