Revert "fix: SetupIDs() now detects if Editor is running. fixes a bug where changing any NetworkIdentity setting at runtime would clear the NetworkIdentity.assetId, causing respawn bugs where client would receive an empty assetId (forceHidden -> not forceHidden)."

=> this broke two of the runtime tests previously
This commit is contained in:
vis2k 2021-02-18 13:40:01 +08:00
parent ae5875203e
commit dd29d99be2

View File

@ -610,17 +610,6 @@ public void SetSceneIdSceneHashPartInternal()
void SetupIDs() void SetupIDs()
{ {
// IMPORTANT: DO NOT EVER try to change ids at runtime!
// fixes a bug where changing any NetworkIdentity setting
// at runtime would clear the NetworkIdentity.assetId,
// causing respawn bugs where client would receive an
// empty assetId (forceHidden -> not forceHidden).
// => changing any setting would call OnValidate
// => OnValidate calls SetupIDs which would not find the
// prefab connection at runtime and reset the assetId!
if (EditorApplication.isPlaying)
return;
if (ThisIsAPrefab()) if (ThisIsAPrefab())
{ {
// force 0 for prefabs // force 0 for prefabs