How to add child GameObjects to parent in Script?

I made and exported a fbx model in 3dsmax. It’s just 2 simple primitive planes that each have their own texture. These two primitives are grouped together to make one fbx model.

When i import this Fbx model to Unity, it makes a basic gameobject with transform and “childs” the imported fbx model to 2 children gameobjects. Each child gameobject has the meshfilter and renderer components. So when i use the transform component from the parent gameobject the 2 children gameobjects(my fbx model)will also be affected.

It does what i want it to do but i need to do this in script at runtime and not via the inspector. So how would i set this up in script for runtime and avoid doing this in the inspector?

I would need to make a basic gameobject class and 2 other gameobjects that would be children of the parent gameobject. These 2 children gameobjects would contain my meshes and textures. Anyone know how to do this in script? Im using c# .

It’s easy just do for both childobjects:

this.transform.parent = yourParentObject;

There are diffrent approaches to find yourParentObject have a look at this:
http://docs.unity3d.com/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html

Regards,
BPR

GameObject parentObj;
GameObject childObj;

childObj.transform.parent = parentObj.transform;

See correct solution at