Answer the question
In order to leave comments, you need to log in
Why can't I set localPosition?
After creating the object using the Instantiate method, I set its position:
Transform tBlocks = blocks.GetComponent();
tBlocks.localPosition = new Vector3(0f, -350f, 0f);
But X is shifted by some number. How to fix it?
Answer the question
In order to leave comments, you need to log in
The x isn't shifted anywhere, it's zero in exponential notation, it's just because of the transform hierarchy and other math noise that your float has slipped to the side by a very small value. The result is bitwise different from zero, but in fact it is still one. It may also be that this is a purely visual glitch of the RectTransform interface, after all, you didn’t change the anchoredPosition , but worked through the parent class, and that’s how it happened.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question