Material disappears after LoadScene
Hey everyone, I'm currently trying to load a scene which has a gameObject with a specific material attached to in it. If I start the scene itself, it works perfectly well and the material can be seen. However, I want to start the game by pressing a button on a menu screen. Therefore, I'm loading the scene with the gameobject after the scene was chosen from the start menu. The problem is: If I start the game this way, the material is somehow lost and my gameobject is just black. This is the code for the Sceneload: public void Level1() { SceneManager.LoadScene("Spider_baker_2"); } public void DemoLevel() { SceneManager.LoadScene("Level_0"); } public void EndScene() { SceneManager.UnloadSceneAsync("Menu 3D"); }
It tried to use Scenemode.Additive, but then another issue occurs, since I can't instantiate more instances of my singleton classes from the menu scene. If I then try to develop it for the HoloLens, the application crashes completey, so I'd rather stay away from the Scenemode.Additive. Has anyone ever had this issue?
Answer by TabacoHabano · Oct 24, 2017 at 08:14 PM
Hello! I had a similar issue testing my game in the Unity's editor, but I found a solution that I believe resolves it.
Seems that the colors and materials are loaded correctly in my case, so it was a lighting problem as lighting is still calculating in the background.
Depending on your Unity version, you can fix this by:
Open the scene which has the problem with the materials;
Go to tab 'Window' --> Lighting --> Settings
Then, in the 'Scene tab'. Scroll down until the bottom of the emerged window and find a checkbox called 'Auto Generate' which you have to disable/uncheck.
Finally, click the Generate Lightning button and check if it works
Seems that this problem only occurs at the editor, not once the game is build. Please, let me know if it works. Good Luck!
Had a similar problem. This worked for me. Thank you!
Your answer
Follow this Question
Related Questions
How to load material onto sphere? 1 Answer
Render Pipeline Material Issue 1 Answer
Can someone change this array to use materials instead of textures 1 Answer
Raw Image changing texture in inspector but not in game. 1 Answer
Lighting issues despite not having normals,Lighting not displaying correctly despite no normal maps 0 Answers