1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Tracking status / position of certain (such as NPC / enemies) between scene changes

Discussion in 'Game Design' started by vdoggstudios, Jun 18, 2017.

  1. vdoggstudios


    Dec 22, 2016
    Hi All

    I have a couple of scenes.

    Scene 1 contains a few boxes which can be shot. These boxes (prototype enemies) have healthpoints and when shot their healthpoints decrease, they're also moved by the impact (AddForce).

    In this scene I also have a trigger which loads you to scene 2 when you stand on it.

    Scene 2 is just an empty scene with the exception of a trigger which loads scene 1 again.

    What I want to do is shoot some enemies / boxes to kill them, and move them around the level a bit - then enter the trigger to scene 2, then enter the trigger in scene 2 to go back to scene 1 and have the boxes in the same position as they were when I went to scene 2 (i.e. not in their default positions). I also want their healthpoints/status to persist.

    I'm just wondering what the theory is behind doing something like this?

    Would I have to store the position of each object in a static game control object (for example). Would I have to write a bit of code for every object? This would be ok for a few objects but could become unwieldy for a bigger game.

    Would it be possible to get the position and healthpoints of all objects with a certain tag/layer when switching scene and store this data in a file which can be read when loading the scene again?

    Any advice would be greatly appreciated. Thanks.
  2. Teila


    Jan 13, 2013
    You are asking about implementing mechanics in the game, not about design. You will get more help in the scripting forum than here or going to Learn and doing some tutorials.

    Please move your post so you can get the help you need.
    vdoggstudios and BoredMormon like this.