Objects not visible when scene reloaded.

Hi all,

I’ve noticed an issue with the app I’m working on where it doesn’t look correct when reset, which I do by reloading scene 0. I made a simple test project to try and pin down the issue.

Currently I’ve got a camera which views a plane with a red material assigned. When you run the app in the Unity Editor, you just see a red square, as expected. I’ve added a simple script to reload scene 0 when the space key is pressed. When you do this however, 100% of the time, the screen goes black and the red square never reappears.

I can’t for the life of me see what I’m doing wrong. The Unity Editor’s scene window shows the plane is still present, it’s game object and components are all still active and have the right settings. In my full app, when deployed to an Android device, this doesn’t happen all the time but when it does it’s always the same plane which disappears. All my other visuals remain intact.

I’ve attached my stripped down project to this question. If you want to see this issue for yourself just download it, open the project, open the “main” scene if it doesn’t automatically, hit play and then tap space.

If anyone knows what’s going on with this please let me know and thanks in advance!

[68326-restarttest.zip|68326]

Hello! While not a direct solution/answer to what is going on, I have a work around for you. :slight_smile:
When playing around with your project I noticed on reset, the plane material’s color changed to match the emission color perfectly.

Since you set your emission to be black:
68343-emissionisblack.png

On reset the entire material’s color changes to black. If the emission is set to any other color, on reset the material and square change to match the emissions color perfectly.

You’ll have to play around with the colors so that on reset the color matches what you want.

I apologize that it’s not a perfect solution or answer to what is happening, as I’m not too well-versed in Unity’s Materials/Shaders, but it’s an observation I thought I should share.

Good luck!

Hi,
I know that this question is old, but I have the answer that I think might help others facing the same issue.
The gameobject materials going completely black on scene reset is due to “Auto-generate” being checked in the Lighting panel. This issue will only occur in the editor and not the build. However, to rectify the issue in the editor, simply uncheck the “Auto-generate” option and you are good to go.