|
|
|
|
|
|
{ |
|
|
|
// 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
|
|
|
|
|
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |