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,17 +35,13 @@ NetworkIdentity myView
{
get
{
if (m_MyView == null)
{
m_MyView = GetComponent<NetworkIdentity>();
m_MyView = 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;
}
return m_MyView;
}
}
// ----------------------------- Commands --------------------------------