#Clients not properly initializing and inputs not registering

1 messages · Page 1 of 1 (latest)

fair mesa
#

ive roughly followed this tutorial https://www.youtube.com/watch?v=ZT0scwlNtVc&list=PLfLOlXy59QopXWQXdj-9PixyBBwtzfFfZ&index=3
and while ive slightly deviated its not been in ways that should cause any errors with the server rpcs, yet the flag for client initialization doesnt seem to be workingf as the server keeps giving me connected client pings for the same connected clients + the inputs no longer work.

fair mesa
#
    protected override void OnUpdate()
    {
        _clients.Update(this);
        var commandBuffer = new EntityCommandBuffer(Allocator.Temp);
        foreach (var (request, command, entity) in SystemAPI.Query<RefRO<ReceiveRpcCommandRequest>, RefRO<ClientMessageRpcCommand>>().WithEntityAccess())
        {
            Debug.Log(command.ValueRO.message + " from client index " + request.ValueRO.SourceConnection.Index + " version " + request.ValueRO.SourceConnection.Version);
            commandBuffer.DestroyEntity(entity);
        }
        foreach (var (id, entity) in SystemAPI.Query<RefRO<NetworkId>>().WithNone<InitializedClient>().WithEntityAccess())
        {
            commandBuffer.AddComponent<InitializedClient>(entity);
            SendMessageRpc("Client connected with id = " + id.ValueRO.Value, ConnectionManager.serverWorld);
        }
        commandBuffer.Playback(EntityManager);
        commandBuffer.Dispose();
    }
#

the repeat is the client connected with id

#

i tried adding an int value that started at 1 and would get added to throughout the foreach loop to see if it was stuck looping or something stupid but it stayed at 1 throughout

crisp birch
#

Did you make sure to make the GoInGameRequest that adds the NetworkStreamInGame component to your connection?

fair mesa
#

no idek how i forgot to tbh

#

thanks

fair mesa
#

although i have noticed that the guy in the tutorial conveniently basically refuses to show his console from this point on so it might just be a negligible issue

crisp birch
fair mesa
#

👍

fair mesa
crisp birch
#

Huh, so SystemAPI.Query<RefRO<NetworkId>>().WithNone<NetworkStreamInGame >().WithEntityAccess() is still getting a hit every frame?

fair mesa
#

yep

crisp birch
#

And that's on the server, right?

fair mesa
#

sorry for the really late reply was busy w housework and stuff

crisp birch
#

Not sure what would cause that. You can check the entity hierarchy for Network IDs and maybe track down why it's not getting the NetworkStreamInGame component.

fair mesa
#

on the client

#

on the serverworld

#

so it does seem to be adding them

#

just also not recognising that fact

fair mesa
#

i use it in all the same places

crisp birch
fair mesa
crisp birch