unity import sketchup model and assign a material to one group

I’m new to unity but I have some scripting basic aptitudes. my problem is: I have some sketchup model (.obj) that contains “groups”. I import them to unity using objImporter. the problem is that when the object is Imported, I do not have access to any subgroup, and i need that acces to change texture of part of my models. can someone help me with it please?

here is my code:

    //object to spawn
    var objToSpawn = new GameObject("my object name");
    //Add Components
    objToSpawn.AddComponent<Rigidbody>();
    objToSpawn.AddComponent<MeshFilter>();
    objToSpawn.AddComponent<BoxCollider>();
    objToSpawn.AddComponent<MeshRenderer>();

    objToSpawn.GetComponent<Transform>().localScale = new Vector3(0.001f, 0.001f, 0.001f); //the model use milimeters, so i scale it
    objToSpawn.GetComponent<Transform>().position = pos;//i put it at the good position

    objToSpawn.GetComponent<Collider>().attachedRigidbody.useGravity = false;
    objToSpawn.GetComponent<Collider>().attachedRigidbody.isKinematic = true;//if i don't use it, when i put other component, it all explode

    var holderMesh = new Mesh();
    var newMesh = new ObjImporter();
    holderMesh = newMesh.ImportFile("PATH/to/my/object.obj");
    objToSpawn.GetComponent<MeshFilter>().mesh = holderMesh;//turn my object into a mesh
    objToSpawn.GetComponent<MeshRenderer>().materials[0] = Resources.Load(texture) as Material;//whatever i put here i got default texture instance for the whole model
    objToSpawn.GetComponent<Rigidbody>().interpolation = RigidbodyInterpolation.Extrapolate;

    //try to get subgroups or whatever i can but i have no idea how
    var allMesh = objToSpawn.GetComponentsInChildren<MeshFilter>();
    foreach (MeshFilter child in allMesh)
    {
        Debug.Log(child.name);//write "my obect name" in the console
        //instruction to assign a texture material to the group X
    }

I don’t get the groups hierachy like if I just drag and drop my .obj into the scene, just the gameObject’s name i thanks you by advance, if i do it the wrong way I’m open to any advices.

(I have to admit that my english is quiet poor)

i figured it out myself after hours of work, the thing is I shouldn’t have used ObjImporter.
Somme textures are still missing but I’m working on it.

here is my answer for myself and other with the same problem:

    private bool placePlan(string fileName, Vector3 pos, float r, string texture)
    {
        try
        {
            //load my 3D model
            var objToSpawn = Resources.Load(fileName, typeof(GameObject)) as GameObject;

            objToSpawn.GetComponent<Transform>().localScale = new Vector3(0.001f, 0.001f, 0.001f);      //the model use milimeters, so i scale it
            Quaternion rot = Quaternion.Euler(new Vector3(0, 180 + (-r * 180 / (float)Math.PI), 0));    //i adapt it to my data flux rotation

            //I load and apply some .jpg texture 
            Texture2D tex = Resources.Load(texture, typeof(Texture2D)) as Texture2D;
            objToSpawn.GetComponent<Transform>().GetChild(0).GetComponent<Renderer>().sharedMaterials[0].mainTexture = tex as Texture2D;

            //I instantiate my model an VOILA I have it with the whole hierarchie just like I had drag and drop inside the user interface
            Instantiate(objToSpawn, pos, rot);

            return true;

        }
        catch (Exception e)
        {
            Console.WriteLine("{0}

", e.Message);
return false;
}
}