Can't rotate a parent object by selecting the child

I have a script that handles mouse click object selection & drag rotation for some cylinders. These cylinders have a child cube attached to it. The click & drag rotation works on the cylinders if I select the cylinder directly, but not the child cube.

I have some code that assigns the transform to the platform variable like so:

RaycastHit hitInfo = new RaycastHit();
bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo);
if (hit) 
{ 
    if (hitInfo.transform.gameObject.tag == "Rotatable")
    {
        this.platform = hitInfo.transform; // this works
    }
    if (hitInfo.transform.gameObject.tag == "Stoppable")
    {
        Debug.Log("Hit child, rotate parent: " + hitInfo.transform.parent.name);
    	this.platform = hitInfo.transform.parent; // this doesn't
    }
}

The weird thing is that the debug message outputs the correct name of the parent transform. I want to be able to rotate the cylinder the exact same way when I click and drag the cube as if I’m clicking and dragging the cylinder.

Turns out, this code works as is after some refactoring around the object (platform) selection. Before, I had attached this script to the parent game object itself and NOT the child which prevented it from working. After attaching the same script to the child object, things started working, but it wasn’t ideal as I didn’t want the script to be overused.

I now have only one empty game object with this script attached that selects the objects (with appropriate tag) based on touch position. Hopefully, this helps someone out in some way.

perhaps you need to complete the reference to:

this.platform = hitInfo.transform.parent.transform;

… not sure, just a thought.