guycalledfrank / bakery-issues

Bug tracker for Bakery
4 stars 0 forks source link

Reflection Probes delete on play #60

Open Dknighter opened 3 years ago

Dknighter commented 3 years ago

This only happens when using Bakery.

The bug is when using the refresh mode "via scripting". I am now having to manually render all of the scenes reflection probes when the scene plays when it should act the same way as the refresh mode "on awake".

Manually rendering the reflection probes on awake is ok for small amounts of reflection probes however with scenes that have a lot of probes it takes up a lot of time and makes the scene look terrible for the first few minutes.

guycalledfrank commented 3 years ago

Make sure that lighting data asset in assigned to the scene, as it gets reloaded on scene init

image

(Something must be there)

If for some reason it was not generated (??), try e.g. "Update skybox probe" as it also initializes it.

Dknighter commented 3 years ago

Hey,

Yes it is there and it is using the one generated by Bakery.

Again, this only happens when using the refresh mode "via scripting".

guycalledfrank commented 3 years ago

Weird. I don't do anything to reflection probe objects at all. Possibly the lighting data asset stores some reflection-related info which is not possible to manually examine or modify. Lighting data asset generated by Bakery is actually generated by Unity (when it opens an empty temporary scene and calls Unity's bake for the sake of the generating the black box asset file).

Also... aren't via-scripting probes only expected to update after you call the update? I thought this is exactly the difference between on-awake and via-scripting. Docs say:

Sets the probe to never be automatically updated by Unity while your game is running.

I guess never should be never?

Also maybe you can have them with on-awake and then dynamically change to via-scripting after the game is launched?

Dknighter commented 3 years ago

This only started happening when I started using Bakery.

"via scripting" also acts like "on awake" and gets pre-rendered in the editor before playing and can be updated in code afterwards. However since using Bakery, the reflection probes set to "via scripting" have been completely resetting/ clearing when entering play mode.

guycalledfrank commented 3 years ago

There isn't much I can suggest beyond my previous post. Seems like switching from on-awake to via-scripting after the game is launched is the easiest fix. I don't know how Bakery can even affect it, but we also don't know the details of the obfuscated lighting data asset: https://forum.unity.com/threads/lighting-data-asset-was-a-mistake.547591/

The way Bakery updates reflection probes is the same as clicking this:

image

It literally just calls the same method (Lightmapping.BakeAllReflectionProbesSnapshots).

Actually to make it store the data SOMEWHERE, it first copies emptyLightingData.asset and inserts it to the scene. Then Unity will update it after the method is called. In case it's related to lighting data asset version incompatibility, you can try generating any lighting data asset in any (almost) empty scene on your Unity version and replace my emptyLightingData with this file. Then it should be used as a base for new scenes.