-
Notifications
You must be signed in to change notification settings - Fork 153
Description
Hi ,
I have created a Button with this code :
private UIButton createButton(string imageName, ClickType clickType, float scale, ref List objList)
{
var button = UIButton.create(spriteToolkit, imageName, imageName, 0, 0);
button.onTouchUpInside += (sender) => GUIClickEventReceiver.OnClick(clickType);
//button.localScale = new Vector3(scale, scale, 1f);
objList.Add(button);
return button;
}
And created Text with this code :
private UITextInstance createText(string text, float scale, ref List objList)
{
UITextInstance textInstance = uiText.addTextInstance(text, 0, 0, scale);
textInstance.alignMode = UITextAlignMode.Center;
objList.Add(textInstance);
return textInstance;
}
When I position them on the screen they are not being placed at the same location when given the absolutely same positions.
Like for example :
var button = createButton("Button.png", ClickType.StartGame, 0.8f, ref mainMenuUIObjects,new Vector2(Screen.width/2,Screen.height/2)); // play
button.positionFromRight(-0.2f, 0.02f);
var text = createText("Start", 0.9f, ref mainMenuUIObjects);
text.positionFromRight(-0.2f, 0.02f);
Here button and text does not place at the same place.
How to resolve this issue ?