I’m just trying to load the next scene but Unity is making things more complicated than they should be. I get no errors, the scene changes, but everything is completely black, every time I change scenes there is zero visibility. This wasn’t even happening an hour ago and I haven’t changed any lighting settings since then as far as I know… but I made a title screen and since then even the old loadscenes that used to work no longer work. I had previously used SceneManager.LoadScene and it was working in other instances but even those cases no longer work and I didn’t even touch those ones, so what could have happened then? There must be some simple solution to this which makes it more frustrating because I’ve tried everything to no avail. Does anybody know why the scene loads and is completely black all of the sudden? It shouldn’t do that. I don’t understand it at all. Each scene is visible on its own, and LoadScene doesn’t work even if I build the project.
The problem is, there’s no errors… so I have no idea what could be causing it and therefore I can’t really give much specific information. Does this sound familiar to anybody else? Thanks.
I’m ready to just completely restart my project if it’s going to be giving me a hassle.
Please let me know if you know what could have caused this issue thank you.
All of the objects are completely drawn fully black as if it’s a lighting issue but I didn’t change any lighting settings…
I think we need a little more information to be able figure out what’s going wrong.
Such as:
- How is the new scene being loaded? Additively or singularly?
- Are you loading via build index or maybe scene name? Have you changed the build index at all?
- Is there a camera in the new scene (if loading singularly)?
- Is the scene being successfully loaded at all?
‘Everything is completely black’ is a bit vague. Everything in my scene is sometimes completely black because something went wrong with moving my player character to the correct spot, and the camera is following him through the abyss. Or it could be that there’s no camera.
And final note: I would use addressables when loading scenes; it’s a lot more straight forward than the old SceneManager method.
Figured it out. Thank you for the feedback Spiney199. Here was the solution (and of course, it was simple, which is irritating).
Here’s what I did to fix it:
- First I had to open up the scene that was showing up black.
- And then I literally just had to go into Window → Rendering → Lighting (for my scene that was showing up black)
- Go to the Environment tab
- “Generate Lighting” button to create a folder for the scene’s lighting so that it doesn’t completely ruin the lighting for some reason.
Because I guess otherwise it was resetting the lighting back to 0 for some reason?
It was rather simple after all, I have no idea what happened and I can’t explain it but that’s how the issue was solved in case anybody else has this issue I’ll leave the post up. Thank you.
And I’ve used C# before but I’m new to Unity so thank you for the feedback about addressables.
Hey all good, glad you figured it out!
I’ve encountered that before too. I believe when you change active scenes in run time, it uses the lighting data/settings of the new active scene. In run time this needs to be prebaked, even if you don’t have any actual baked lighting. Catches me out regularly too.
You don’t have to do that… you can learn to debug. It’s easy… and here’s the most-powerful and universal approach to debug ANY computer software problem, regardless of platform or CPU or anything:
You must find a way to get the information you need in order to reason about what the problem is.
What is often happening in these cases is one of the following:
- the code you think is executing is not actually executing at all
- the code is executing far EARLIER or LATER than you think
- the code is executing far LESS OFTEN than you think
- the code is executing far MORE OFTEN than you think
- the code is executing on another GameObject than you think it is
To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.
Doing this should help you answer these types of questions:
- is this code even running? which parts are running? how often does it run? what order does it run in?
- what are the values of the variables involved? Are they initialized? Are the values reasonable?
- are you meeting ALL the requirements to receive callbacks such as triggers / colliders (review the documentation)
Knowing this information will help you reason about the behavior you are seeing.
You can also put in Debug.Break() to pause the Editor when certain interesting pieces of code run, and then study the scene
You could also just display various important quantities in UI Text elements to watch them change as you play the game.
If you are running a mobile device you can also view the console output. Google for how on your particular mobile target.
Here’s an example of putting in a laser-focused Debug.Log() and how that can save you a TON of time wallowing around speculating what might be going wrong:
https://discussions.unity.com/t/839300/3