Solar-System icon indicating copy to clipboard operation
Solar-System copied to clipboard

Atmosphere disappears when I change the scene

Open Kitseru opened this issue 3 years ago • 3 comments

When I change the scene or reload the current one (using SceneManager.LoadScene) it seems that the PlanetEffect postprocessing effect no longer works (all the image is black except unlit shaders), and I get the error :

MissingReferenceException: The object of type 'CelestialBodyGenerator' has been destroyed but you are still trying to access it.

and the warning :

OnRenderImage() possibly didn't write anything to the destination texture!

Does anyone know where this is coming from?

Kitseru avatar Mar 27 '22 22:03 Kitseru

Same now. It used to work fine for me.

Nevermind. Cannot replicate again. It fixed itself.

Panicat avatar Aug 01 '22 18:08 Panicat

Had it again! Fixed by going to every line where "generator" is null, and adding a null check before that.

For example, adding the following at the start of UpdateSettings():

if (generator == null) return;

(realised this only fixes the error and makes things visible, atmospheres don't show with this method)

Panicat avatar Jan 14 '23 09:01 Panicat

Or try these two things two things that work for me:

  1. Clear() the list effectHolders in PlanetEffects and call Init() (in PlanetEffects.cs as well)
  2. Make the settingsUpToDate bool in AtmosphereSettings.cs public and turn it off after changing the scene

Panicat avatar Jan 20 '23 14:01 Panicat