Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - iron59

Pages: [1] 2
1
NGUI 3 Support / Re: Placing Adjacent Sprites by Their Edges
« on: March 18, 2016, 04:38:13 AM »
We were able to make progress and the sprites seem to be in their appropriate positions in their initial state. However, we're still encountering the gaps in certain tutorial steps. Our understanding is that it's because of half-pixel problem or something related to the position not exactly compliant to per pixel local position of the sprites. Please see the following screenshots.

The InitialGUI is the screenshot of the sprites while they are not playing. Each cover that surround the center sprite has their own anchors as shown in the screenshots. The Highlighter is the center sprite while the InputBlockerPanel is the UIPanel of the entire overlay. The center sprite has no anchor at all since it's the one that should move and resize freely to highlight a part of the screen. The Line screenshot shows the sample of a line gap while the game is running.

Here is my code on how I move and resize the center sprite.

  1. /**
  2.  * function to a activate highlighter with the following position and size
  3. */
  4. public void Highlight(float xPos, float yPos, int width = 0, int height = 0, float fadeDuration = 0.2f) {
  5.                 this.highlightWidget.alpha = 0f;
  6.                 NGUITools.SetActiveSelf(this.highlightWidget.gameObject, true);
  7.  
  8.                 NGUIMath.OverlayPosition(this.highlighter.transform, new Vector3(xPos, yPos, this.highlighter.transform.position.z), GameObject.FindObjectOfType<UICamera>().cachedCamera);
  9.                 this.highlighter.width = width;
  10.                 this.highlighter.height = height;
  11.                 Vector3 localPos = this.highlighter.transform.localPosition;
  12.                 localPos.x = Mathf.RoundToInt(localPos.x);
  13.                 localPos.y = Mathf.RoundToInt(localPos.y);
  14.                 this.highlighter.transform.localPosition = localPos;
  15.  
  16.                 DOTween.To(() => this.highlightWidget.alpha, a => this.highlightWidget.alpha = a, 0.9f, fadeDuration);
  17. }
  18.  

Pardon the UICamera not being cached. I'll clean that part. Here, the highlightWidget is the parent of the highlighter sprite. I've also rounded the local positions coordinates to the nearest integer since as far as I understand, NGUI components use sizes and positions on a per-pixel basis. Is there anything I can add here to achieve the ideal dimensions so that no gaps will be shown in between the sprites? If this is the wrong approach for overlaying, can you suggest a correct implementation? Thank you very much.

2
NGUI 3 Support / Placing Adjacent Sprites by Their Edges
« on: March 04, 2016, 04:59:14 AM »
Good day. I'm trying to implement a selective overlay for our tutorial. I saw this post ( http://www.tasharen.com/forum/index.php?topic=13587.msg60950#msg60950 ) and used this approach. Everything seems to be working properly after I implemented it except that I'm having a hard time placing the sprites so that their non-transparent parts don't overlap. The 1st screenshot below is the default positions and sizes of the sprites while the second one is after my code has taken effect in the actual game. Is there a way to fix this so that I can get rid of the lines/gaps? Thank you very much.


3
NGUI 3 Support / Re: Anchors Not Updated Immediately
« on: August 02, 2015, 07:33:08 PM »
Sorry about that. I updated my package to 3.9.1. The outcome is still the same. Still having a problem with the anchors.

4
NGUI 3 Support / Re: Anchors Not Updated Immediately
« on: July 30, 2015, 07:46:53 PM »
The Execute attribute is set to On Update. For what it's worth, I'm using Unity 5.1.0f3 Personal Edition. NGUI version 3.8.0.

5
NGUI 3 Support / Anchors Not Updated Immediately
« on: July 28, 2015, 06:27:25 AM »
Good day. I have a UI sprite that acts like a sliding window. I'm using an anchor to keep that window at the edge of the panel. However, I've observed that changing the resolution in the game window does not apply the anchor immediately as you will see in NewRes.png. The red window is still pixels apart from the edge of the panel. However, when I click the resolution dropbox of the game window (take note, I haven't changed the resolution yet, just expanding the drop-down component), the window is moved to its proper position. I think this behaviour is carried over to the actual build as I see incorrect positions of my window in my test device (asus zenfone 5). Any suggestions on how to resolve this? Thank you very much.

6
NGUI 3 Support / Re: Blurry Sprites in WebGL Build
« on: April 21, 2015, 11:19:20 AM »
Oops. I overlooked that setting. Problem solved. Thank you. :)

7
NGUI 3 Support / [RESOLVED] Blurry Sprites in WebGL Build
« on: April 20, 2015, 10:35:23 AM »
Good day. This is the first time that I'm using NGUI for WebGL builds. It seems that the sprites rendered in WebGL are noticeably blurry. I compared this with a PC build. I've atttached some screenshots for reference. Do you have any suggestions on how to resolve this? Thank you very much. :)

8
Just tested this in the Unity Editor. When Unity loses it focus and resumes, the UILabel disappears (See Screenshot below). When I try to edit the text of a label in the editor, the UILabel re-appears. I'm using Dynamic fonts, so maybe it's causing this behaviour, but I want to ask if anyone has a workaround for this. It only happened after I upgraded to Unity 5. Thank you.

9
NGUI 3 Support / Re: Gizmos, Handles, and Context Menu not working
« on: March 10, 2015, 08:12:41 PM »
Ok go it working. Sorry, I wasn't aware of that new feature.

10
NGUI 3 Support / Gizmos, Handles, and Context Menu not working
« on: March 06, 2015, 09:38:24 AM »
Good day. I updated to Unity 5 and upgraded my NGUI package to 3.8.0. However, after the update, I'm not seeing the gizmos and handles anymore. I also noticed that the context menu is not working too. I tried to toggle the options for Gizmos and Handles but nothing has changed. Any suggestions on how to fix this? Thank you very much.

11
NGUI 3 Support / Re: Layout/Anchor of UI Elements Messed Up in Editor Mode
« on: November 10, 2014, 01:04:17 AM »
Sorry I didn't know it was a an issue with the Unity's new version. Found the solution here http://www.tasharen.com/forum/index.php?topic=11671.msg54269#msg54269
Thank you for your response.

12
NGUI 3 Support / Layout/Anchor of UI Elements Messed Up in Editor Mode
« on: November 09, 2014, 09:35:40 PM »
I noticed this when I upgraded my package from 3.0.9 f3 to 3.7.5. When I tried to adjust the positions of my UI Elements (with the UIRoot set as a prefab), the layout is messed up when I drag it to the scene while it's not played. Upon closer look, it seems the anchor is not getting the UI Root's bounds and extend farther away. Take a look at the screenshots below.
The UI behaves as expected when I run the game getting the correct bounds for the anchor. Can I have some suggestions on how to resolve the proper layout when in editor mode? Thank you very much

13
NGUI 3 Support / Re: Scrollview - Tweening Clip Size and Position
« on: January 31, 2014, 10:36:29 PM »
To be honest with you I'm not sure what to suggest in your case that would be simple. To do something unusual like this you will most likely need to do your own custom tweening logic where you adjust the panel's rect, while at the same time also possibly adjusting the clipping offset by half of the rect's adjustment, and the transform's position by the opposite of the offset's adjustment.

For the custom tweening part, I actually performed the step of tweening the panel's clipping as I've written in my post above, is it possible to start from there? If it's possible I would need the mathematical formula to do the necessary calculations (e.g. getting the valus of the rect adjustment and tanslating it to something that can be applied to the new position of the selected item). I just need to know the actual formula and algorithm to perform the right steps. Thank you.

14
NGUI 3 Support / Re: Scrollview - Tweening Clip Size and Position
« on: January 31, 2014, 05:50:59 AM »
I almost got the problem fixed now. I used a parent UI panel for the item lists' scroll view and then used it for a SpringPanel to implement the change in positions. My only problem is, I need to move the scroll view's position to the selected object prior to the change in positions. Since I'm changing the clipping size of the scroll view, I can't shift the scroll position using UICenterOnChild. To clarify, I really need the adjustment of clip size since on the normal view it shows 9 items, while after the preview it should only show three items but the scrolling feature should be maintained. I'm thinking of adjusting the center of the clipping rect to display the selected object but I'm kinda lost with the proper formula to do that. Any suggestions on how to do this? Thank you very much.  :)

15
NGUI 3 Support / Re: Scrollview - Tweening Clip Size and Position
« on: January 30, 2014, 08:32:29 PM »
Thanks for the response. My problem is, the item list (the ones with the black sprites) consist of many items that need to be scrollable, so I can't use the scrollview to contain the preview window and the items list since NGUI doesn't support nested clippings like what you've said. I'll try to explore the Spring panel.

Pages: [1] 2