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 the_moe_syzlak_connection · Oct 29, 2010 at 01:24 AM · scene-loadingscene-switching

scene switching

First, the confession about being new to Unity and game programming in general. Now that that is out of the way I am looking for a way to switch from scene A to scene B, with the state of A frozen so I can switch back. The idea is that I want to have an inventory button so that a player can switch to an inventory scene, choose weapons/equipment/etc, and then switch back to the game proper in exactly the state he left it. Does Unity support this in some simple way (please please please) or will I have to jump through some hoops to make it happen?

Thanks

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by cncguy · Oct 29, 2010 at 01:35 AM

You could either save information using playerprefs and reload it when you change scene.

or

you could have a gameobject that persists through scene changes, ie. is not destroyed. See Application.DontDestroyOnLoad() in the docs. Basically that object would have a script that maintains the info of all the inventory items you do or don't have.

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

Answer by Echofiend · Oct 29, 2010 at 10:46 PM

Could you use

Application.LoadLevelAdditive("YOUR_INVENTORY_SCREEN");

to accomplish this? I think it could work for what you are suggesting. Of course there are some other ways to do it as well, such as not even making it another screen, but more of a GUI object that will show when a flag is set correctly.

void OnGUI()
{
 //this needs to be in the OnGUI function so that Unity will actually render it to the GUI.
    bool showInventory;
    if(showInventory)
    {
        //Perform your inventory stuff here, such as showing the item icons and such.
    }
}

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

No one has followed this question yet.

Related Questions

Scene loading problem 5 Answers

Help with error message "Overwriting the same path as another open scene is not allowed" 0 Answers

,Enums not being passed between scripts properly 1 Answer

CheckConsistency: GameObject does not reference component Animator. Fixing. 0 Answers

Variables are resetting after loading the play scene 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