I’m trying to set the value of a BufferFromEntity object using GetBufferFromEntity(). My code is NOT running in a JobComponentSystem because my job isn’t supposed to run on update. Just when I trigger some event do I want to schedule my job for that frame only. So I don’t have access to JobComponentStystem.GetBufferFromEntity().
I looked into the source code and found that JobComponentSystem just wraps around EntityManager.GetBufferFromEntity() so I thought I’d just use that and cut out the middle man. To my surprise, The documentation and source code for EntityManager has absolutely no reference to the method I’m looking for and I can’t call it.
This is according to preview 33.
Does anyone have any suggestions? I would think that there would be some way to call a method in a JobComponentSystem on a single given frame but I can’t seem to find any examples.
My usecase is that I want to schedule my job on canvas button press. But the Button component needs a reference to a monobehaviour in order to do that.
You shouldn’t be using GetBufferFromEntity unless you’re passing it to a job in JobComponentStystem due to dependency handling. GetBufferFromEntity doesn’t just call EntityManager.GetBufferFromEntity it adds a dependency to the safety system on that component.
And from the sounds of what you’re doing you should still be scheduling your job in a JobComponentStystem that only updates conditionally when an event is present, something like.
If I’m understanding the docs correctly, RequireForUpdate makes it so that OnUpdate will only run when there are entities in the world that satisfy the query. But in my case, my queries are always in existence. I just want to run the job once by clicking a button which calls a method in a monobehaviour which somehow calls a method in my JobComponentSystem. Am I missing something?
I’m sorry I’m just finding it hard to understand what you mean by an event entity? Are you suggesting to tag all my entities with some empty component data and query for those? And then after the job is complete, remove the componentdata tags so that the component system no longer runs?
Some of the physics samples kind of demonstrate it but they are pretty complicated for just beginning dots. Eizenhorn described exactly what you need to do. Which part of it are you unclear about?