guycalledfrank / bakery-issues

Bug tracker for Bakery
4 stars 0 forks source link

Render (Legacy) Light Probes file generation issues #53

Open Zurigan opened 3 years ago

Zurigan commented 3 years ago

This is all with the 'use scene named output path' option enabled.

With one scene (Home) open the first time 'Render Probes' is used an asset gets created named something like 'Home_371857150_probes'.

Clicking the same button again without changing anything will sometimes generate another file 'Home_371857150_copy'.

With multiple scenes loaded the generated file is named after whichever scene happens to be higher in the Unity hierarchy window but stored in the path/folder of the active scene. Think this should use active scene for both.

With multi-scene setups, rendering Legacy light probes will effectively switch the active scene to whichever is lowest in the Unity hierarchy before you hit the render light probes button.

guycalledfrank commented 3 years ago

The "copy" asset is created when the original file is locked by Unity for unknown reasons. The number is the hash of all currently loaded scenes, so it's unique for the current combined set. The name is of the first scene, just to give a human-readable hint of what it can belong to. Not sure I get what exactly bothers you.

Zurigan commented 3 years ago

If I want to use Legacy probe generation with two scenes loaded I have to 1. make sure I get the order of them right in the Unity hierarchy by setting the one I'm rendering from to the top. Then, post rendering light probes, re-set the active scene to the top one.

guycalledfrank commented 3 years ago
Zurigan commented 3 years ago

Maybe delete the copy file with an error message instead?

The active scene is the 'main' one ... placing the file in the active scene path is good, giving it the wrong name because the active scene isn't the first in the Unity hierarchy is bad.

edit - does look like the render button preserves the active scene correctly so, just an issue with the light probes one.

guycalledfrank commented 3 years ago

That's the problem, I can't delete the file which is locked, so I'm forced to create a new one... next time Unity locks the "copy" file, I write to the non-copy one instead, and they swap.

Can confirm the active scene was not set back properly after the legacy light probe render, fixed: https://github.com/guycalledfrank/bakery-csharp/commit/d046ba618e9d00c132f5bdc381ac4920cfbb4661

Zurigan commented 3 years ago

I can see why doing the double-file-switch makes sense for making it easier on someone who just wants to see results ASAP ... but it does end up causing garbage file generation.

What I'm suggesting is that Bakery fail instantly, with an error/warning to the developer, if it can't delete the usual file. So, maybe the dev has to press the render button twice - this would be preferable to manually removing files.