As in the title, i have an array of positions and i want to do something like:
pnlInventory1.transform.position = ArrayOfPositions[0];
pnlInventory1.transform.y = pnlInventory1.transform.y + 20;
So whats the problem? What is it you ACTUALLY want to do, because it clearly isn’t what is written in your post.
What you have written is perfectly valid code.
It’s not a perfectly valid code because “transform.y” doesn’t exist as a keyword; The question is : Which keyword i must use to move only on the y axis?
True, I missed that. Translate would probably be the best and simplest method.
https://docs.unity3d.com/ScriptReference/Transform.Translate.html
pnlInventory1.transform.Translate(0f, 20f, 0f);
1 Like