For some reason this code isnt working
using Unity.Burst;
using Unity.Collections;
using Unity.Entities;
using Unity.NetCode;
using Unity.Physics;
using Unity.Physics.Systems;
[BurstCompile]
[UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
[UpdateAfter(typeof(PhysicsSystemGroup))]
partial struct CollisionEventsSystem : ISystem
{
internal ComponentDataHandles m_ComponentDataHandles;
internal struct ComponentDataHandles
{
public ComponentLookup<CharacterHealth> characterHealthLookup;
public ComponentLookup<PhysicsVelocity> PhysicsVelocityLookup;
public ComponentLookup<BulletData> bulletDataLookup;
public ComponentDataHandles(ref SystemState systemState)
{
characterHealthLookup = systemState.GetComponentLookup<CharacterHealth>(false);
PhysicsVelocityLookup = systemState.GetComponentLookup<PhysicsVelocity>(false);
bulletDataLookup = systemState.GetComponentLookup<BulletData>(false);
}
public void Update(ref SystemState systemState)
{
characterHealthLookup.Update(ref systemState);
PhysicsVelocityLookup.Update(ref systemState);
bulletDataLookup.Update(ref systemState);
}
}
[BurstCompile]
public void OnCreate(ref SystemState state)
{
state.RequireForUpdate(state.GetEntityQuery(ComponentType.ReadOnly<PhysicsVelocity>()));
m_ComponentDataHandles = new ComponentDataHandles(ref state);
}
public void OnUpdate(ref SystemState state)
{
m_ComponentDataHandles.Update(ref state);
state.Dependency = new ProcessCollisionEventsJob
{
characterHealthLookup = m_ComponentDataHandles.characterHealthLookup,
physicsVelocityLookup = m_ComponentDataHandles.PhysicsVelocityLookup,
bulletDataLookup = m_ComponentDataHandles.bulletDataLookup,