- Home /
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!
Answer by DivinityStripes · Apr 19, 2016 at 05:01 AM
Hello! While not a direct solution/answer to what is going on, I have a work around for you. :) 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:
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!
Nicely noticed! That will allow me to work around the issue. Seems like this may well be a Unity bug then though it can't have been around long as it feels like something lots of people should have encountered. I've added it to the bug tracker.
Answer by jignesh_n_patel · Dec 26, 2018 at 05:53 PM
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.
Your answer
Follow this Question
Related Questions
Make Object Invisible in One Scene and Visible in another scene upon click of mouse 1 Answer
Renderer on object disabled after level reload 1 Answer
Make invisible wall appear visible upon collision/detection 1 Answer
Only render part of object inside a circle 2 Answers
Prefab Invisible on Canvas 0 Answers