Hi all,
I’m using transform.localScale to scale my object during runtime. I get a different result from when I scale from the editor because in the editor the attack point is set to center while in the script I only can use pivot.
Is it possible to use an object’s center as scale attack point instead of its pivot?
Thanks in advance.
I’m not sure what you mean…if your pivot is .5, .5 in the editor, it should be using the center to scale. So if you’re changing localscale, it should be using the center. What is it you’re trying to do exactly?
I have a gameobject, under that I have a block of cards nice and neat in order. I set up a rig that makes the order match the screen aspect ratio then I scaled it to fit the screen best, but sometimes on high res small screen mobile devices it leaves too much space and it is hard to see it so I plan to set up a scale bar for it.
The bar works, except for this issue I mentioned.
The cards are generated and after all of them are done, they get parented under this GO via script.
In the editor when I hold down the scale tool, it shows that the GO’s pivot is at its first child’s pivot.
but it scales it correctly from the middle as I selected “the tool handle is placed at the middle of the object”
if I change it to “pivot” the handle jumps to the first child’s pivot. and that is how my script scaling works.
All in all I need to set the script’s transform.localScale to scale from the center.