• 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 /
This question was closed Mar 25, 2014 at 08:47 AM by Fattie for the following reason:

Duplicate Question

avatar image
Question by abcdog · Mar 25, 2014 at 05:05 AM · input setting

Getting data from other scene or script

Sorry, I am new to unity. I am making a game with my friends. The game has a menu and there is a setting button that can set such as sound on / off , and quality etc. And in the game play screen there is also a sound on / off button to mute the music.

My question is how can I save and get the status about it is sound on or sound off? Because if the player press the sound off button in the menu page, that means they want to mute the sound and they will not want to press it again on the game play screen. So when they press the sound off button in the menu page, music or sound should be off or mute in the game play screen when they playing.

But how can I get the status of sounds are on / off?

Hope someone can help me ! Thank You !

Comment

People who like this

0 Show 0
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

  • Sort: 
avatar image
Best Answer

Answer by supernat · Mar 25, 2014 at 06:07 AM

You can save persistent data using Player Preferences. https://docs.unity3d.com/Documentation/ScriptReference/PlayerPrefs.html

As for saving state data in your game, one paradigm is to create a management script that calls "DontDestroyOnLoad()" in its start method, and place the script on an empty game object that is created in the first scene you load. The script can then provide interfaces (like setVolume, getVolume) for other scripts to access. If you make everyt$$anonymous$$ng static in the script, it becomes even easier as you can access those static interfaces without having to have a game object instance in any scene. There are of course other ways to solve it. Instead, you might create an Audio script that specifically handles saving/retrieving audio volume.

Comment

People who like this

0 Show 0 · 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

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

21 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

Related Questions

I am using the Logitech Driving force GT (steering wheel and pedals) with the standard asset car, when I move my foot from the accelerator the car doesn't slow down?? can anyone help? 0 Answers

Settings Bug? 0 Answers

New Unity Input System Getting continuous input 1 Answer

No user input without checking on every update? 1 Answer

New Input System: Can't set binding path anymore 2 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