|Topic was automatically imported from the old Question2Answer platform.
So, if I create a button using TouchScreenButton and assign a texture to it, the texture will be displayed on the left bottom of the TouchScreenButton position (See image below)
The TouchScreenButton position is in the top left corner of the rectable
When I don’t assign a texture and instead I create a sprite as the child node and assign a texture to it, it will display the texture in the center of TouchScreenButton.
But the shape is still follows what I have said earlier.
My question, How do I create the center of TouchScreenButton texture in the center of the TouchScreenButton position along with it’s shape?
I want the TouchScreenButton is in the middle of the TouchScreenButton texture.
I’m afraid i can’t follow: that’s the default and shown by your first screenshot. The second screenshot only looks different because the Sprite is centered around the position of the TouchScreenButton instead of its center-point. I don’t understand what you’re trying to highlight with that, but you can uncheck the
centered-property of the Sprite, if you want to change that.
njamster | 2020-08-08 22:06
Sorry if the question is not clear enough, I have removed the last sentence.
I it’s the anwer, I have to uncheck the centered shape property to make the shape in the center of the TouchScreenButton.
The solution is I have to create a sprite as a child node and uncheck the centered shape property
andraantariksa | 2020-08-09 01:21
I still don’t get what you’re trying to do, sorry. If you uncheck the “Shape Centered” property then the shape won’t be in the center of the TouchScreenButton but in its upper left corner! There’s no built-in way to move the Texture there as well. But why would you want to do that in the first place?
njamster | 2020-08-09 19:40
If I uncheck the “Shape centered” then the center of the shape will be exatly in the button position right? I need it because the I need the button location to be parallel with other node
andraantariksa | 2020-08-10 05:18