Make a GameObject a Child of What it Collides With

I’m making a game with arrows. I’m trying to make the arrows stick to the objects that it collides with, and move around with it.
How would I do this?

I’ve tried adding constraints to the arrow on collisions. This stops it from moving when it collides with an object, but if you move that object, it does not move with it.

I’ve also tried to set the parent of the arrow to the object it collides with by using

transform.parent = collision.transform;

But that doesn’t work either.

Could it be that the arrow is a rigid body still in motion? try stopping it after setting the parent.

hi;
u can use transform.SetParent(object to parent , false) ;

but the code u mention above should work too ;
so the problem maybe else where in your scripts;
show the full script so i check it ;