'Instantiate only an active child

guys! I've got a problem with instantiation. I am trying to instantiate a visible child object on the Raycast. So far, I can instantiate only a parent object and cannot figure out how to instantiate only a visible child object.

enter image description here

Here is the code I am using now:

    RaycastHit hit;
    if (Physics.Raycast(ray1, out hit))
    {
        if (hit.collider.gameObject.GetComponent<SelectableTrunk>())
        {
                    GameObject STrunk = Instantiate(RandomSTrunk);
                    STrunk.transform.position = hit.point;
                    STrunk.transform.LookAt(hit.transform.position + hit.transform.forward, hit.normal);
        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source