浏览代码

Merge pull request #1666 from Unity-Technologies/FixLightIntensityUpgrade2

Fix light intensity upgrade for disabled lights
/main
GitHub 6 年前
当前提交
b1e0d042
共有 2 个文件被更改,包括 11 次插入14 次删除
  1. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs
  2. 21
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Light/HDAdditionalLightData.cs

4
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs


if (m_UpdateAreaLightEmissiveMeshComponents)
UpdateAreaLightEmissiveMeshComponents();
// If the light is disabled in the editor we force the light upgrade from his inspector
foreach (var additionalLightData in m_AdditionalLightDatas)
additionalLightData.UpgradeLight();
}
void DrawFoldout(SerializedProperty foldoutProperty, string title, Action func)

21
com.unity.render-pipelines.high-definition/HDRP/Lighting/Light/HDAdditionalLightData.cs


{
// Note: We can't access to the light component in OnAfterSerialize as it is not init() yet,
// so instead we use a boolean to do the upgrade in OnEnable().
// However if the light is not enabled, the light is not upgraded.
// To solve this issue we add a callback below that will force OnEnable() to upgrade the light.
#if UNITY_EDITOR
//EditorApplication.update += EditorOnEnableWorkaround;
#endif
// However OnEnable is not call when the light is disabled, so the HDLightEditor also call
// the UpgradeLight() code in this case
version = currentVersion;
#if UNITY_EDITOR
// See comment above, this is a workaround to upgrade Disabled light correctly.
void EditorOnEnableWorkaround()
private void OnEnable()
OnEnable();
EditorApplication.update -= EditorOnEnableWorkaround;
UpgradeLight();
#endif
private void OnEnable()
public void UpgradeLight()
{
if (needsIntensityUpdate_1_0)
{

}
#pragma warning restore 0618
}
version = currentVersion;
}
}
}
正在加载...
取消
保存