Unparent and parent back at the same frame, possible?

I wonder if something like that is possible:

child.parent = null;
parent.position = some_vector3;
child.parent = parent;

It would be really handy in case when you want to move the parent object without moving the child. Is it a valid solution?

Sure, that works… it might have more impact than simply storing the child position and restoring that, which is how I always do this:

var TempPos = child.position;
parent.position = newPosition3;
child.position = TempPos;

I would intuit that would cause far less bookkeeping since the hierarchy didn’t change, but it likely wouldn’t matter unless you were doing a LOT of these things each frame.

1 Like

Thanks, good to know!

1 Like