- Home /
Starting with Unity 5.3 AssetDatabase.GetAssetPath returns empty string on LightmapSettings.lighmaps[x].lightmapFar
I wrote a Lightmapping plugin (LightmapMagic) for store and switch lightmaps at runtime. The plugin manages a sequence of bake processes via Lightmapping.BakeAsync().
When the bake process is finished (Lightmapping.completed notify), the plugin duplicates lightmap data and starts to bake the next light configuration.
There is a problem starting with version 5.3 of Unity getting the lightmap asset path because AssetDatabase.GetAssePath(LightmapSettings.lightmaps[i].lightmapFar)
returns an empty string.
I don't know how to resolve the problem.
Thanks.
Tried Unity 5.3.1 also, nothing to do. For now patched with:
#if UNITY_5_3
string curScene = UnityEditor.Scene$$anonymous$$anagement.EditorScene$$anonymous$$anager.GetActiveScene ().path;
string[] parts = curScene.Split ('/', '\\');
string sceneName = parts [parts.Length - 1].Split ('.') [0];
string lightmapPath = Path.GetDirectoryName (curScene) + "/" + sceneName + "/";
assetPath = lightmapPath + "Lightmap-" + j + "_comp_light.exr";
#else
assetPath = AssetDatabase.GetAssetPath (LightmapSettings.lightmaps [j].lightmapFar);
#endif
Answer by paraself · Jan 20, 2016 at 04:43 AM
I tried to get the path of a sprite, neither it works!
Answer by aresundnes · Dec 22, 2015 at 01:10 PM
It seems like in Unity 5.3 LightmapSettings.lightmaps does not reference the texture on disk - rather the temporary one in memory
Your answer

Follow this Question
Related Questions
Lightmaps on mobile inconsistant 4 Answers
When i bake lightmaps my meshes just explode into a harsh glow? 0 Answers
Getting dark patches in baked light maps when baking with Final Gather in Unity 5.3.7 1 Answer
Baking Lightmaps often gives this Strange Results 1 Answer
Baking artifact (Generated Lightmap UV, Prioritized illumination, Increased lightmap resolution) 0 Answers