How to instantiate exactly on the requested place with 0 offset.

I’ll cut to the chase, i’ve been creative on the ways to make it work, but none of them do.

I’m doing a sidescroller runner game and as the sets get instantiated, they get instantly put into a container that moves all the items inside. this helps both having organized hierarchy and just one item carrying the transform.position movements instead of all the children in a per object basis.

The problem is that these objects are moving and the check is done in update method, giving some discrepancies as to what the actual position was → where it will instantiate. Given that the object is moving, a one frame difference when spawning causes a few units of offset which I cannot allow. Why can’t I allow it? because it’s simply not the right choice.

One of the methods was calculating the delay, still shows offset, even though it might be less.

Another method was to calculate the offset given the game speed using the framecount, didn’t work either, because apparently it doesn’t see any difference in frames, meaning it wasn’t actually done in the next frame.

Now I tried another approach, what if I don’t calculate when instantiating itself, but rather when it’s already all parented and then I move the container to the last endpoint (meaning the gizmo that I spawn to see where the set ends onscreen). Hey, I think I got it, nope… there’s still an offset. How is it possible that I have an offset if I’m telling it to move exactly to that position?

Given that right now i’m dry on ideas as to how to make it work, I’ll just put the problem most possible cause: it’s all continuously moving. So what I’m asking is which way would it be appropiate so a transform.position kind of movement does not cause a value offset when I literally tell another object to move to that precise object position.

Okay, I think I got it, apparently explaining problems really helps to internalize thoughts sometimes. I don’t like my current solution so i’m still open to suggestions to improve it, but currently making a yield waitforseconds worth a second of time previous to the transform.position operation seems to do the trick. it feels like something happens if the operation is too quick in terms of sequential processing.

I don’t know wether I should think this is a bug on sequential order of computation and maybe I should report it, then again i’m too amateur to even verify it’s a bug and not just my bad coding practices. who knows.

PS: this is no joke, i’ve been trying to fix this for a month or so, with about 4 attempts to change code. Brb going to buy a rubberduck.