Hello, I am making a game and i have been trying to make projectiles. I am trying to make the projectile a trigger and then use it to do damage. But the trigger events have not been running, I have made sure that the projectile has raise trigger events and the targets have colliders.
Here is the system with the trigger events:
using Unity.Entities;
using Unity.Burst;
using Unity.Jobs;
using Unity.Physics;
using Unity.Physics.Systems;
[UpdateInGroup (typeof (FixedStepSimulationSystemGroup))]
[UpdateAfter (typeof (PhysicsSimulationGroup))]
public partial struct ProjectileSystem : ISystem
{
[BurstCompile]
public void OnCreate (ref SystemState state)
{
state.RequireForUpdate<ProjectileDataComponent> ();
}
[BurstCompile]
public void OnUpdate (ref SystemState state)
{
JobHandle handle = new ProjectileJob
{
}.Schedule (SystemAPI.GetSingleton<SimulationSingleton> (), state.Dependency);
state.Dependency = handle;
}
[BurstCompile]
public partial struct ProjectileJob : ITriggerEventsJob
{
public void Execute (TriggerEvent triggerEvent)
{
UnityEngine.Debug.Log ("Hit");
}
}
}
Thanks in advance!