Search Unity

Resolved How to modify a component inside ICollisionEventsJob?

Discussion in 'Physics for ECS' started by Evgeni_Incineration, Nov 10, 2022.

  1. Evgeni_Incineration

    Evgeni_Incineration

    Joined:
    Jul 4, 2022
    Posts:
    27
    Hello everyone,

    I have been trying to find a way to modify a component of a colliding entity to no avail.
    Here is the whole system in question: https://gist.github.com/Zammy/c8afbed44676bc2019a2abd091884da8

    The problem is persisting changes to LifeComponent on the last lines of code inside the job.
    I tried using EntityComponentBuffer, I tried using "writable" ComponentLookup.

    Any tips and code samples that can help me out will be highly appreciated.

    Thank you
    -Evgeni
     
  2. Evgeni_Incineration

    Evgeni_Incineration

    Joined:
    Jul 4, 2022
    Posts:
    27
    Turns out I had zero damage on the projectile component.
     
    dannyalgorithmic and JMPM-UNITY like this.