Why Transform don't have "AddChild" method?

Hello.

Normally, Hierarchy object have a method such as “addChild(child)”.

But, Transform object don’t have this method.

In Unity, normally we do this with following method.

ex)
childTransform.parent = parentTransform;

from Unity - Scripting API: Transform.parent

I want to know that why Unity’s Transform don’t have “addChild” method.

Thank you for reading this question.

I can’t answer why they don’t have one, but it would be easy enough to create one yourself as an extension method.

public static class GameObjectExtensions
{
	public static void addChild(this GameObject go, GameObject child)
	{
		child.transform.parent = go.transform;
	}
}

Then you can use it like any other function on GameObject:

public class UseTheExtension : MonoBehaviour
{
	public void SomeFunction()
	{
		this.gameObject.addChild(someOtherGameObject);
	}
}