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