Set gameObject.transform in 1 line

Hello all,

This is probably a silly question.
I have a GameObject with several children set up in the editor. In a script attached to the parent I create several more child GameObjects in code. The GameObjects created in the code have to get the exact same Transform as the GameObjects made in the editor. object.transform can’t be set since it’s readonly and I understand why.

Is there any way I can copy the values from one Transform to another in 1 line? Right now I have to set the position, rotation and localscale, which is 3 lines of code. For 20 GameObjects that 60 lines of code just to set their transforms. (no I can’t use a loop in this case)

Thanks in advance.

Create a function, passing in the objects as parameters - do all of the assignments inside the function.