• 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 Akuma_Reiten · Sep 23, 2012 at 06:37 PM · playerscenedatapostion

Retaining old scene data

Working on a proof of concept game which is spilt into two types of control, an FPS and a space simulator. I have the two setup in separate scenes and you can easily switch between the two on a click of a button.

My question is, I want to keep the positions of everything in those two scenes even if there not running, so if you run around as the FPS and switch- when you switch back you’ll be back standing where you were.

I’ve looked up some ways of doing this, but I’m still new at this and looking for the best way. Is there an easy way to retain the players position? And from there is there an easy way to retain the information of all the other objects in a scene? (Positions, damage, destroyed, etc).

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 justinl · Sep 28, 2012 at 07:34 AM

You'll want to write a SaveState script that iterates through every object in your scene and records their data such as rotation, position, health, type of object before the scene is unloaded and the new scene starts.

Then, once you return to your scene, you'll need to iterate through this list and re-instantiate everything in your list and set them to where they were in the world, and to whatever action they were doing.

I'd recommend a List data structure to manage this list or you can roll your own Class that can hold this information.

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 Akuma_Reiten · Sep 28, 2012 at 08:35 AM 0
Share

Thanks, I'll start looking into that.

avatar image
0

Answer by Unity_gamer · Sep 28, 2012 at 09:44 AM

you can Try "Application.LoadLevelAdditive" as well . http://docs.unity3d.com/Documentation/ScriptReference/Application.LoadLevelAdditive.html

While Loading the next scene you can Manually delete the unwanted old Scene Contents.

Good luck..:)

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.

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

11 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

Related Questions

How to keep position of a Game Object when switching scene? 3 Answers

Player object carried from scene to scene 1 Answer

Understanding Prefabs + Player Spawn Points 2 Answers

Share Occlusion Culling Data among Same Scenes 2 Answers

Move Player to new scene without it resetting. 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