NetworkIdentity.OnValidate: wrap in #if UNITY_EDITOR in case OnValidate is needed at runtime later

This commit is contained in:
vis2k 2019-03-04 17:43:51 +01:00
parent 8eb27ea0af
commit ed64872163

View File

@ -147,9 +147,9 @@ internal void RemoveObserverInternal(NetworkConnection conn)
observers?.Remove(conn.connectionId);
}
#if UNITY_EDITOR
void OnValidate()
{
#if UNITY_EDITOR
if (m_ServerOnly && m_LocalPlayerAuthority)
{
Debug.LogWarning("Disabling Local Player Authority for " + gameObject + " because it is server-only.");
@ -157,8 +157,10 @@ void OnValidate()
}
SetupIDs();
#endif
}
#if UNITY_EDITOR
void AssignAssetID(GameObject prefab) => AssignAssetID(AssetDatabase.GetAssetPath(prefab));
void AssignAssetID(string path) => m_AssetId = AssetDatabase.AssetPathToGUID(path);
bool ThisIsAPrefab() => PrefabUtility.IsPartOfPrefabAsset(gameObject);