/// <inheritdoc /> protected override IEntitySpawnResults OnEntityConstructionCompleted([NotNull] IPlayerSpawnContext context, [NotNull] IEntitySpawnResults result) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (result == null) { throw new ArgumentNullException(nameof(result)); } //Check if the spawn was a success. If not we don't want to add information about it to the network services. if (result.Result != SpawnResult.Success) { return(result); } //TODO: Verify that none of this is in the services/collections all ready. MAJOR ISSUES if we are getting multiple of the same entity. EntityCollection.Add(context.EntityGuid, new EntityContainer(context.EntityGuid, result.EntityGameObject)); PeerCollection.Add(context.OwnerPeer); ConnectionRegistry.Register(context.OwnerPeer.PeerDetails.ConnectionID, context.EntityGuid); return(result); }