From f0723e50ddbdbc71b8e5c2f36a39bd5f92c742c9 Mon Sep 17 00:00:00 2001 From: Paul Pacheco Date: Tue, 9 Oct 2018 23:53:02 -0500 Subject: [PATCH] simplify with null coalesce --- Mirror/Runtime/NetworkBehaviour.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Mirror/Runtime/NetworkBehaviour.cs b/Mirror/Runtime/NetworkBehaviour.cs index e58b7067c..47c1f2a92 100644 --- a/Mirror/Runtime/NetworkBehaviour.cs +++ b/Mirror/Runtime/NetworkBehaviour.cs @@ -35,14 +35,10 @@ NetworkIdentity myView { get { + m_MyView = m_MyView ?? GetComponent(); if (m_MyView == null) { - m_MyView = GetComponent(); - 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; }