浏览代码

Merge pull request #1778 from Unity-Technologies/Emergency-fix-for-reflection-probe

Do a late update to avoid crash for InfluenceVolume in Probe
/main
GitHub 7 年前
当前提交
c3c43d6d
共有 2 个文件被更改,包括 25 次插入9 次删除
  1. 31
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs
  2. 3
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs

31
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs


public ReflectionProxyVolumeComponent proxyVolume { get { return m_ProxyVolume; } }
/// <summary>InfluenceVolume of the probe.</summary>
public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } private set { m_InfluenceVolume = value; } }
public InfluenceVolume influenceVolume
{
get
{
// We need to init influence volume with a probe. We can call a constructor with 'this' in this case,
// we can't do it in Awake (not call in editor) or on OnEnable either.
// So do a late init when trying to access it
if (m_InfluenceVolume == null)
m_InfluenceVolume = new InfluenceVolume(this);
else if (!m_InfluenceVolume.IsInit())
{
m_InfluenceVolume.Init(this);
}
return m_InfluenceVolume;
}
private set
{
m_InfluenceVolume = value;
}
}
/// <summary>Multiplier factor of reflection (non PBR parameter).</summary>
public float multiplier { get { return m_Multiplier; } }

{
get { return m_RefreshMode; }
set { m_RefreshMode = value; }
}
void Awake()
{
if (influenceVolume == null)
influenceVolume = new InfluenceVolume(this);
else
influenceVolume.Init(this);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()

3
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs


}
}
/// <summary>Return if an influence volume have been correctly initialize with a probe.</summary>
public bool IsInit() { return probe != null; }
/// <summary>Offset of this influence volume to the component handling him.</summary>
public Vector3 offset { get { return m_Offset; } set { m_Offset = value; } }

正在加载...
取消
保存