0
\$\begingroup\$

I have a unity game with a menu scene and multiple levels that I want a user to re-visit. Both the menu and scenes make use of a gallery with an image in it.

When I load from the menu to the scene and back again, the images sometimes go missing. I don't think this happens on first load - but it seems to occur once I've loaded away from a scene. Ie - Menu > Scene > Menu might mean the menu is missing an image. Or Menu > Scene > Menu > Scene might mean the scene misses an image.

I don't believe I want DontDestroyOnLoad because I don't want the objects to remain between scenes - but I wonder if the scene level gets cleared when you load away from it? Is there any way I can totally refresh the scene back to its original point? I haven't seen this mentioned in any guides - but I wonder if more often scenes are not reused.

Is there anything I can set on the image or texture itself to ensure that it isn't cleared without keeping visible between scenes? Or any other suggestions!

\$\endgroup\$
7
  • \$\begingroup\$ To help you with this, we need to know how you're loading/displaying the image in the first place. Can you walk us through the steps needed to reproduce a Minimal Complete Verifiable Example of the problem? Once we can reproduce the issue in a new, empty Unity project, we can test proposed solutions to be sure they'll work for you. \$\endgroup\$
    – DMGregory
    Oct 31 at 22:55
  • \$\begingroup\$ I am using an asset called VR3DMediaViewer - this asset takes an array of its own asset (VR3D > Stereoscopic Image) that has a texture attached and some settings such as if the image is in Side By Side format \$\endgroup\$ Nov 1 at 4:13
  • \$\begingroup\$ I didn't realise pressing enter would post that comment! I have a script that changes to the next image in the array on pressing a button on the controller. The thing that is confusing to me is - why does the image succeed in the scene in isolation but not when changing between scenes? Is there any behaviour of textures/objects other than DestroyOnLoad that should affect resources between scenes like this? \$\endgroup\$ Nov 1 at 4:15
  • \$\begingroup\$ So for example - loading Gallery Scene 1 works perfectly, I can cycle through all images - however, adding the menu and scene 1 to the build settings, and using a button press to LoadScene(1) now means that some of the images do not load \$\endgroup\$ Nov 1 at 4:19
  • \$\begingroup\$ As far as a minimal verifiable example - I am not sure what exactly you would need - but I have a 3D pipeline scene created in Unity 2022.3.2f1. I am using XR Origin as it is a VR project and a VR3DMediaViewer gallery with a number of images loaded into it that can be cycled through. \$\endgroup\$ Nov 1 at 4:22

0

You must log in to answer this question.

Browse other questions tagged .