DylanD Posted July 3, 2018 Share Posted July 3, 2018 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! Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 3, 2018 Share Posted July 3, 2018 I would like to see an example on PG Samme. This subject interests me Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted July 3, 2018 Share Posted July 3, 2018 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. DylanD 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted July 3, 2018 Share Posted July 3, 2018 You can also use the AssetContainer which was designed for this mission http://doc.babylonjs.com/how_to/how_to_use_assetcontainer DylanD 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted July 4, 2018 Share Posted July 4, 2018 I have never seen this before, cool DK! Quote Link to comment Share on other sites More sharing options...
DylanD Posted July 4, 2018 Author Share Posted July 4, 2018 12 hours ago, Deltakosh said: You can also use the AssetContainer which was designed for this mission http://doc.babylonjs.com/how_to/how_to_use_assetcontainer I think I will use this method. Thanks everyone for the responses! GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.