7 public static void CopyTo(
this IEntity entity,
IEntity target,
bool replaceExisting =
false, params
int[] indices) {
8 var componentIndices = indices.Length == 0
9 ? entity.GetComponentIndices()
11 for(
int i = 0; i < componentIndices.Length; i++) {
12 var index = componentIndices[i];
13 var component = entity.GetComponent(index);
14 var clonedComponent = target.CreateComponent(index, component.GetType());
15 component.CopyPublicMemberValues(clonedComponent);
18 target.ReplaceComponent(index, clonedComponent);
20 target.AddComponent(index, clonedComponent);
static void CopyTo(this IEntity entity, IEntity target, bool replaceExisting=false, params int[] indices)