how to attach an object to a parant on Creation

heyy everyone i really need help i have been trying to do this for the last half hour now what i need is for when i create the game object by left clicking on the ground as as soon as it is made it because a child of another game object called CullingObjects the object is called test house if it helps anyone. if this isnt clear then please tell me and i will try to make it sound clearer thanks

You can make one game object a child of another as follows:

object1.transform.parent = object2.transform;

thanks for trying mate but i have already seen that on the script reference and a line just doesn’t explain how to do it i am only new to scripting

Ok, what part do you need help with then? Do you have some code you can post?

Never mind thanks for your help i just figured it out i forgot to search for the objects and here is the code for anyone who wants it.

var CA : GameObject;
var CO : GameObject;
function Awake () {
    CA = GameObject.Find("Test House(Clone)");
    CO = GameObject.Find("CullingObjects");
    CA.transform.parent = CO.transform;
}

and thanks alot for taking your time to help me i really appreciate it.

iv got another problem now its still with the same script i thought i had fixed it but now when i make an object in my game the first object gets attached to CullingObjects but then after that every other object does not and i tried using function Update but still same thing can anyone help me?