Jump to content

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!

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...