Open 32haojiufangjia opened 1 year ago
From Google Translate:
Hello sir, I found during testing that this statement has GC. Is there any way to solve it?
@32haojiufangjia yes, please try
_group.AsEnumerable().AsParallel().ForAll(Execute);
Fyi, when doing things in parallel, please avoid using generated methods like entity.AddXyz(), entity.ReplaceXyz(), entity.RemoveXyz(), etc, since they result in modifying non-concurrent collections like HashSets, etc. When doing things in parallel I recommend changing the component values directly, e.g.
entity.health.value -= 1;
先生,你好,我在测试中发现这段语句有GC,请问有办法解决吗