How do I spawn a prefab to be the child of a mesh?

With javascript, I’m trying to instantiate a prefab to be the child of a mesh that is already spawned. By doing this I’m hoping that when the mesh rotates or moves the prefab will follow-up on the action. How might I go about doing this?

Set the parent:

newobject.transform.parent = otherobjectwithmesh.transform;

Note that a Mesh (actually a MeshRenderer) is a component in a GameObject, and every GameObject has a transform component such that the parent members form the gameobjects into the hierarchy. So you don’t make children of a mesh directly but rather through the transform of their GameObject.