Hello.
I have created a .png composed by 97 images which were 60x60.
So, it’s resolution is 5820x60, the size is 365Ko.
I would like to create an animated button based on that picture.
I have created a button with an image and a mask 60x60, and I created a child to it, where I put my png in the sprite component.
Now, I want to move it with a script, and it is where I have a problem. Here my script :
Vector2 move;
void Start()
{
move.x = 0.0f;
move.y = 0.0f;
}
void FixedUpdate ()
{
move.x -= 60.0f;
GetComponent<RectTransform>().anchoredPosition = move;
(if move.x <= 5820)
{ move.x -= 0.0f; }
}
}
So :
It work for the “Left” attribute of the Rect Transform, as it should, BUT it also modify the “right” attribute, so it doesn’t work properly. I try a lot of things, but I cannot find a way to move ONLY the Left attribute.
Could you help me with that ?
Maybe, do you know a better solution to do that sort of animations which is not too heavy ?
Thanks.