Dynamically creating an empty GameObject as a child of THIS gameObject - How to? - C#

Hey.

What the title says, how do I post or pre creation of a new GameObject (empty) and then make it become a Child of the gameObject which the script which spawned it is attached to.

public GameObject DummyObject;
	
	void Start () 
	{
		DummyObject = new GameObject();
	}

This spawns a new GameObject() in the world, but how do I then force it to become a child of this instance of the gameObject

Thanks for reading.

DummyObject.transform.parent = transform;

You’re the man!

Works perfectly I was reading the reference and manual even did some google searches but couldn’t find it.

Looks through tons of drop down stuff in monodevelop too, sometimes you just can’t beat the community forums :slight_smile:

cheers!