Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
This question was closed Mar 25, 2014 at 08:47 AM by Fattie for the following reason:

Duplicate Question

avatar image
0
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
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

1 Reply

  • Sort: 
avatar image
0
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 everything 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
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

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

What could cause my game to act differently after building. 1 Answer

ROLL-A-BALL :THE BALL NEVER MOVES 1 Answer

Help. Can't figure out the new input system or double jump in general 0 Answers

Character won't move (don't know about scripts) 0 Answers

How to get Input Button name? 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