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.
#Clients not properly initializing and inputs not registering
1 messages · Page 1 of 1 (latest)
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
Did you make sure to make the GoInGameRequest that adds the NetworkStreamInGame component to your connection?
have now added it and the input issue i had before is fixed but the connected message still continues to go off
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
I would use NetworkStreamInGame instead of InitializedClient
👍
still didnt fix the issue 💔
Huh, so SystemAPI.Query<RefRO<NetworkId>>().WithNone<NetworkStreamInGame >().WithEntityAccess() is still getting a hit every frame?
yep
And that's on the server, right?
yeah
sorry for the really late reply was busy w housework and stuff
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.
on the client
on the serverworld
so it does seem to be adding them
just also not recognising that fact
also i called it GoInGameCommand which is what the tutorial calls it, should that be causing any issues?
i use it in all the same places
Try using WithAbsent instead of WithNone.
didnt fix it 😔
I could have sworn WithNone works with tags. Maybe the folks on #1062393052863414313 can help.