This line of yours:
characterChilds = new List<Transform>();
Creates a mutable list. However, the following line:
characterChilds = transform.GetComponentsInChildren<Transform>();
Overwrites that list, and so the previous line is useless. Clearly, GetComponentsInChildren
returns an IList
that is not modifiable. If you really want to start from the result of that method call and still be able to modify the list, you can try:
characterChilds = new List<Transform>(transform.GetComponentsInChildren<Transform>());
Now, you can remove items from that list, but without more context, I'm not certain that will do exactly what you're hoping for.