Sign in to follow this  

Keeping an Object through switching scenes?

Recommended Posts

Hey everyone, I have a bit of a strange question, I was wondering if there was a way to keep an object between scenes.

So I have a scene(we will call scene1) with a great looking background and I would like to have in the scene(we will call scene2) that comes after it, however to keep resource use low (or in an attempt to keep them low I should say) I dispose of scene1, just after scene2 has loaded.  This of course disposes of my background, which btw is a image texture on a plane.  

Any idea how I could keep that object/background?


Also one more question since I'm here:

When I move back to scene1 from scene2 it doesn't reload the texture back onto the plane and I'm not sure why.  On the startup of the scene it is loaded perfectly but then when I switch off that scene and back on its gone, not reloaded I mean.  Any ideas why this happens?

Thanks for your time!

Share this post

Link to post
Share on other sites

You could use multiple scenes.
You could serialize it then import it to the other scene.
You could extend the clone function to have a scene to target.
You could... 

You should for lack of a better method with your problem;  just create a function that quickly creates it and just fire it when the scene compiles (its a tiny asset and wont make much impact).

If you were looking at moving some elaborate mesh from one scene to another then maybe the first methods would have more merit.  Computationally I am not sure how many resources you will save from the above methods vs just re-initializing the buffer on a new scene.

The only method that will save you from having to process the same data multiple times is the multi scene solution.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.