Answer the question
In order to leave comments, you need to log in
Unity ECS Change settings in entity?
There is a system in which I want to change the heath.hp parameter in the terget.entity entity.
ArgumentException: The entity does not exist
when starting the application
public class AtackSystem : ComponentSystem
{
protected override void OnUpdate()
{
Entities.ForEach((Entity entity,ref Damage damage,ref Target terget,ref Health heath)=>
{
float hpNow = heath.hp-(damage.damage*UnityEngine.Time.deltaTime);
World.Active.EntityManager.SetComponentData<Health>(terget.entity, new Health {hp = hpNow});
});
}
}
Answer the question
In order to leave comments, you need to log in
Check if your heath exists when the script is executed...
In general, debugging is in your hands...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question