simplify with null coalesce

This commit is contained in:
Paul Pacheco 2018-10-09 23:53:02 -05:00
parent 059730ca37
commit f0723e50dd

View File

@ -35,14 +35,10 @@ NetworkIdentity myView
{
get
{
m_MyView = m_MyView ?? GetComponent<NetworkIdentity>();
if (m_MyView == null)
{
m_MyView = GetComponent<NetworkIdentity>();
if (m_MyView == null)
{
if (LogFilter.logError) { Debug.LogError("There is no NetworkIdentity on this object. Please add one."); }
}
return m_MyView;
if (LogFilter.logError) { Debug.LogError("There is no NetworkIdentity on this object. Please add one."); }
}
return m_MyView;
}