private void PreUnitAttributesInitialization() { GameObject obj = GameObject.Find("Temporary Unit Attributes"); if (obj == null) { obj = this.temporaryUnitAttributesObject; } if (obj != null) { UnitAttributes myAttributes = null; GameObject[] playerUnitAttributes = GameObject.FindGameObjectsWithTag("UnitAttributes"); for (int i = 0; i < playerUnitAttributes.Length; i++) { NetworkIdentity identity = playerUnitAttributes[i].GetComponent <NetworkIdentity>(); if (identity.hasAuthority) { myAttributes = playerUnitAttributes[i].GetComponent <UnitAttributes>(); UnitAttributes tempAttr = obj.GetComponent <UnitAttributes>(); myAttributes.CopyFrom(tempAttr); break; } } if (myAttributes != null) { GameObject[] gameUnits = GameObject.FindGameObjectsWithTag("Unit"); foreach (GameObject unit in gameUnits) { NetworkIdentity identity = unit.GetComponent <NetworkIdentity>(); if (identity != null && identity.hasAuthority) { GameUnit gameUnit = unit.GetComponent <GameUnit>(); gameUnit.unitAttributes = myAttributes; } } } GameMetricLogger.SetGameLogger(GameLoggerOptions.GameIsPlaying); } }