#ISystem codegen fail
1 messages · Page 1 of 1 (latest)
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)]
public partial struct ClientInitializePlayerInputSystem : ISystem
{
private EntityQuery _initQuery;
private EntityQuery _toInitQuery;
public void OnCreate(ref SystemState state)
{
_initQuery = SystemAPI.QueryBuilder().WithAll<PlayerInput>().WithNone<InitializedClientInput>().Build();
_toInitQuery = SystemAPI.QueryBuilder().WithAll<PlayerInput, GhostOwnerIsLocal>().Build();
state.RequireForUpdate(_toInitQuery);
}
public void OnUpdate(ref SystemState state)
{
if (!_initQuery.IsEmptyIgnoreFilter)
{
return;
}
var count = _toInitQuery.CalculateEntityCount();
if (count != 1)
{
Debug.LogError("More than one locally owned input initialized.");
}
Debug.Log("InitializedInput");
state.EntityManager.AddComponent<InitializedClientInput>(_initQuery);
}
}
Here full code of system
So it seems like OnUpdate is not generated at all
and debugging session confirm that
During debugging it feels like code is just going from start to end, without ever triggering any debug log
You sure system is running?
and no logs appear at all, even though system runs past initial early out for sure
yes, it triggers breakpoints
You don't have any code gen inside on update
So I don't really get what needs to generate?
(which it should)
well, if it's not codegen problem, then it's something else
let me show
Never mind somehow missed the query create
here how breakpoint triggers
and here what happens as soon as I press Step Over (only once)
Why do you have require for update and IsEmptyIgnoreFilter (offtopic just a note)
I want to tag only on Client owned entity
different queries
Why not both require for update, anyway not the problem
because I want system not to run when other query exists
it's !IsEmtpy
@outer patio might be worth taking a look
as far as i can tell the code is running?
and all you're saying is Debug.Log isn't executing
code is running, but it's not logging and it's not debugged correctly
also
no component is added
there should be no code gen because you have no code gen
its not burst compiled
so it's just mono
yeah, that's what makes it even more weird
I also nuked library
oh?
yep
seems unlikely something so simple is broken 🤔 but if you've nuked library i got no idea
code gen looks fine
just curiously, what happens if you burst compile it
wait can you check something, go to the directory of hte .cs file
there is no cloned ~ version of the file is there?
No, I already checked 😅
this has been bothering me too a lot lately, so that was first thing I checked
oh you suffering as well? 😦
it was burst compiled initially and it didn't work. now I'll check again
like a virus, slowly spreading
Bursting OnUpdate made no difference
this is very weird. I'll see if this happens in an empty project, but if not I'll probably need a repro
well hold on, you probably wanna debug log before the early out right
because if it debug logs there the thing is running and the isemptyignorefilter is true
that codegen is not the only codegen that happens for isystem, btw
that's the sourcegenerator stuff, which is for systemapi and ije and what have you, but there's also the ilpp stuff, which generates the bursted static entry point for onupdate etc
that stuff you can only see by opening the assembly in ilspy
debugging anything after early out leads to invalid code
i'm saying just print before
to see if the onupdate is running
because if that print prints, the onupdate is running fine, and something else is funky
OnUpdate is running, yes. It's visible from both: System profiler and debugging early out code also works perfectly fine
sooo what makes you think it's a codegen problem? i'm not sure i see anything in that onupdate that needs codegen
It was my first thought. Rn I have no idea what is failing 😅
I rewrote it like this and now it works fine
if (SystemAPI.HasSingleton<InitializedClientInput>())
{
return;
}
var ecb = new EntityCommandBuffer(state.WorldUpdateAllocator);
var count = 0;
foreach (var (input, e) in SystemAPI.Query<PlayerInput>().WithAll<GhostOwnerIsLocal>().WithEntityAccess())
{
ecb.AddComponent<InitializedClientInput>(e);
Debug.Log("InitializedInput");
count++;
}
if (count != 1)
{
Debug.LogError("More than one locally owned input initialized.");
}
ecb.Playback(state.EntityManager);
ah. well so if there's no systemapi etc for sourcegenerators to do, i think it probably just doesn't generate anything for onupdate
but something is funny about original code. It should be valid