Yes, mental illness can affect child custody. If a parent has a mental illness that causes them to act in ways that are harmful to their children, or that makes it difficult for them to care for their children, the court may decide that it is in the best interests of the children to be placed with the other parent. The court will consider all of the factors involved in each case, and make a decision based on what is best for the children.