You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an issue where lightmaps disappear from the SpriteRenderers after exiting play mode in the editor (they are still visible in play mode if started again). Retransferring the settings from the values cached in BakedLigthingSpriteData fixes the issue until the next time you play.
Any ideas what could be causing this?
Many thanks
The text was updated successfully, but these errors were encountered:
The BakedLigthingSpriteData depends on the editor to execute its function and then transfer the lightmap data to the sprintesrender, this data isn't serialized so it depends on the BakedLigthingSpriteData to set everything.
What you need to do is add an update method that only works in editor and if isn't playing like so:
// This method will execute at every editor update event since the class have the ExecuteInEditMode attribute
[Conditional("UNITY_EDITOR")]
void Update()
{
if (Application.isPlaying) return;
TransferLightmapData();
}
That code didn't quite work, but sticking an [ExecuteInEditMode] property on the BakedLigthingSpriteData class and adding the following seems to fix it:
private void OnRenderObject()
{
if (!Application.isPlaying)
{
TransferLightmapData();
}
}
Hey,
Thanks for the excellent scripts!
I have an issue where lightmaps disappear from the SpriteRenderers after exiting play mode in the editor (they are still visible in play mode if started again). Retransferring the settings from the values cached in BakedLigthingSpriteData fixes the issue until the next time you play.
Any ideas what could be causing this?
Many thanks
The text was updated successfully, but these errors were encountered: