-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Baked lighting is broken upon instantiating from Asset Bundle #57
Comments
Ok so, I don't understand exactly when the issue arises? Is it only when instantiated on its own as a GameObject? Can you share the code for how you load it vs for how you load it when it works? -"If I load a scene via an Asset Bundle with the prefab already instantiated inside of it, then the lighting will look correct (although I am seeing that the prefab will lose its static tag)." < This is normal, its the way it works for instantiating scenes through bundles but it still behaves as static (having combined meshes etc) Is the project where you use the Asset bundle the same as where you make the assetbundle? Also can you share some info on Unity version, Render pipeline, etc |
Hi, thanks for the quick reply. I'm running this on 2019.4.26f1 with URP. |
Can you make sure that the other assetbundle you have your prefabs in contains all the lightmap textures? Also can you see in the hierarchy if those are properly assigned in the script? |
I made sure to include the lightmap textures and the LightingData.asset file in the Asset Bundle and ran it again, but see the same issue. |
Can you check the top of the prefab, the object/script PrefabLightmapData.cs? that's where the lightmaps are "stored" |
Let me know if I should be looking at any of these dropdowns specifically. I see 185 items under Renderer Info (with valid mesh references), 20 Lightmaps (with seemingly valid entries), 20 Lightmap Dir (all labeled as null), 20 Shadow Masks (all labeled as null), and 10 items under Light Info (with valid references) |
Ok thank you, everything seems fine, would it be possible for you to make a repo project for me? And empty project with two bundles (scene one with a baked prefab in it) and a bundle of the prefab, with a couple of scenes mimicking your load method. That way I can go in and debug it and figure out the issue for you and see where its failing to load the lightmaps |
Sure, I'll try to get that out to you sometime today. I appreciate your help |
Okay, got a repo setup. Let me know if this works for you |
Sorry, I shouldn't have made that bool toggleable with this demo. You can leave that set to true, because that is how it is being used in this context. |
Thanks, could you also include the prefab in your repo project? That way I can compare the instantiated one from the bundle and the regular one when debugging (need to check if the lightmap is applied at the right coordinates, or if its a shader issue, etc) |
Working on adding those now. Got a lot of random stuff being exported with the prefabs from my main project so I'm working on cleaning that up as I bring them over into this demo repo |
Okay, well, I got the prefabs added to the project and only stripped out the people to reduce the amount of assets that needed to be exported over. The asset bundles currently included in this project are still from the main project though because the process of trying to bake these prefabs in this demo is causing Unity to max out the memory for some reason so I'm unable to make asset bundles based on this repo. |
Ok, looking at the code. It is the other way around. It is when its in its own assetbundle that the prefab is not being lit up. Does the "examplebundle" only contain the apartment or does it contain the other as well? (just trying to figure out how to get the same prefab to work and not work so I can compare) |
It's moreso this:
I was hoping that I could bake the prefabs in the Lighting_Scene that I created within this demo project in order to create those references for you, but when I try to bake them in this project, my Unity Editor gets stuck and uses a bunch of memory during that process. I'll try to get that fixed tonight or tomorrow so that you can properly check those references. I can also provide some screenshots from the main project we have since there seems to be some issues with this demo project at the moment. |
In this demo repo, the examplebundle contains only the apartment. In the main project, however, it contains a bunch of other stuff as well |
Ok I am pretty sure its this same issue here:
I believe its the way URP exports that it leaves the UV1 of meshes off the assetbundle for some reason Originally posted by @Ayfel in #53 (comment) " |
Oh yeah, I remember that thread. I'll try to find a reported Unity bug regarding this or post one myself then. If you do find out a way to force the inclusion of the UV1 or have any ideas that are worth trying out, please let me know. I'll start investigating that further and also post if I find anything promising. Thanks for the clarification in those screenshots as well! |
You are welcome, and let us know if you get some clarification from Unity or find out a good solution : ) |
Did you find any solution? I would like to use this Prefab Lightmapping with Addressables. I have not tried it yet but addressables works with asset bundles under the hood. Unity Version: 2021.3.14f1 LTS |
Hi there, I first wanted to start off by thanking you for making this resource available as it proves to be a powerful solution for a lot of us!
My issue appears in the process of instantiating a prefab with this baked lighting via an Asset Bundle. There are a few things I've tested that are listed out below:
Thanks in advance
The text was updated successfully, but these errors were encountered: