1
NGUI 3 Support / Can't position a Texture with localposition because of weird scaling problem
« on: April 18, 2015, 05:04:54 PM »
Hi,
I'm facing this issue and really can't figure out why it's happening.
I have a 576x576 matchboard top-left centered.
I want to position a texture of a bag to the bottom-left corner and make it walk to the bottom-right corner.
So I do:
Now, in game I'm expecting to work perfectly, instead the localSpace coordinates of the bag are (0,-576, 0) but the bag is far from reaching the bottom of the widget, like there was some kind of weird scaling going on. Even the walking animation to the right stops before it has reached the other corner.
The matchboard is inside a UIRoot with Scaling Style Constrained, and content Width and Height set to 720, both with the Fit option enabled.
What's going on? By what should I multiply _gridSize? I tried with UIRoot.GetPixelSizeAdjustment(gameObject) without success...
Thanks for your time
I'm facing this issue and really can't figure out why it's happening.
I have a 576x576 matchboard top-left centered.
I want to position a texture of a bag to the bottom-left corner and make it walk to the bottom-right corner.
So I do:
- // Creates the bag
- bagObject = NGUITools.AddChild(matchBoard.gameObject, bagPrototype);
- bag = bagObject.GetComponent<Match3EndBag>();
- // Obtains data from the current matchboard grid, such as its dimensions
- UIWidget _UIWidget = matchBoard.GetComponent<UIWidget>();
- float _gridSize = _UIWidget.height;
- // In local space we position it on the bottom left
Now, in game I'm expecting to work perfectly, instead the localSpace coordinates of the bag are (0,-576, 0) but the bag is far from reaching the bottom of the widget, like there was some kind of weird scaling going on. Even the walking animation to the right stops before it has reached the other corner.
The matchboard is inside a UIRoot with Scaling Style Constrained, and content Width and Height set to 720, both with the Fit option enabled.
What's going on? By what should I multiply _gridSize? I tried with UIRoot.GetPixelSizeAdjustment(gameObject) without success...
Thanks for your time