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 - fanling3

Pages: [1] 2
1
NGUI 3 Support / Block clicks from objects in another camera
« on: July 27, 2015, 11:34:00 PM »
I have 2 cameras (A and B, only A contains uiCamera) and are looking at different objects (A and B) respectively, in different layers. I have collider and OnPress functions on object A.

What I want to do is when object B overlaps object A on the screen (but they are actually in different positions in world space), OnPress will not trigger. However the current situation is the OnPress function triggers because camera A cannot see object B (they are in different layers). Even I include all event masks on camera A, still does not work.

Any solution other than cloning an invisible collider in camera A and keep updating its position with object B. Thank you.

2
NGUI 3 Support / Depths of UISprites and Textures
« on: October 10, 2014, 12:39:39 AM »
I have 2 large UISprites, one has higher depth than the other. I have a texture, which is downloaded through WWW in realtime.

I want to place the texture in between 2 UISprites (i.e., UISprite1 overlaps the texture, and the texture overlaps UISprite2). Any way to edit the depth of a mesh renderer (if I put the texture in Quad) in between 2 UISprites, or put the texture into UISprite in runtime?

Thanks.

3
NGUI 3 Support / Re: White line appears for UISprite
« on: August 07, 2014, 04:24:36 AM »
By "shrink" do you mean I use different size (UISprite) from the original png pixel size?

When does the "Padding" option of Atlas take effect? I changed the number and seems nothing happened

4
NGUI 3 Support / White line appears for UISprite
« on: August 07, 2014, 02:39:19 AM »
There are some strange thin white lines (about 1 pixel) on one side of UISprites on some devices.

For example I have a 100 x 100 UISprite, the orginal imported png is also 1:1 aspect ratio. Some devices like ipad 4 and iphone 4 has no problem on display. But on ipad 2 and iphone 5, there is 1 thin white line on the left side of the UISprite.

Most strange thing is some UISprites are fine on ipad 4, iphone 5 and iphone 4 but having white line on ipad 2. End up the screen is perfect for ipad 4 and iphone 4, 1 thin line for iphone 5, 2 thin lines for ipad 2. My Android tablet and Android phone do not have this problem.

Is it related to resolution or something? Or iOS related? How to solve it?

5
Just imagine I am making an iOS Home View, I need to click on each icon to open the app, so I need boxCollider for each UISprite (app icon), right?

And UIDragScrollView needs a collider to work so I can only put UIDragScrollView on each UISprite, end up I am dragging those sprites.

Everytime you quit an app, you will stay on the page you saw last time (for example you scroll to the 3rd page and open an app, you will stay on the 3rd page but not the 1st page after you quit the app), so I have to initialize the localPosition of ScrollView, that's why I am using MoveRelative() and ResetPosition() to achieve this.

That's all what I had and what I want to do. But now the localPosition is wrong after calling these two functions, like what I had mentioned, i want to shift it to left for 560 (-560 for x will let me stay in 2nd page), but the x position is 65 now, end up I am viewing page 1 (shifted a little bit)

6
I am facing a problem that after using
  1. scrollView.MoveRelative(new Vector(-560, 0, 0));
  2. scrollView.ResetPosition();
the x position of the uiScrollView is -65 but not -560,

I traced the code inside ResetPosition(), end up I found the problem is inside SetDragAmount() in UIScrollView.cs, line 573:
  1. if (canMoveHorizontally) pos.x += clip.x - ox
The value of clip.x is 560 and ox is 65, the value of pos.x before assignment is -560, end up the final value of pos.x is -65.

Before this assignment, I found that my another UIScrollView does not have this problem because it returns in line 546
  1. if (b.min.x == b.max.x || b.min.y == b.max.y) return;

Then I figure out the problem because of the gridview setup. For this UIScrollView I have a view like iPhone Home View, where I have 3 x 4 = 12 buttons on ONE page, then I can scroll to another page containing another 12 buttons. I have UIDragScrollView, UIButton, BoxCollider, UISprite, etc for each button.

How to modify to make it works? Thanks.

7
NGUI 3 Support / Disable button after click
« on: July 14, 2014, 05:51:23 AM »
I have UIButton with OnClick event and UIPlay Animation which is about 0.5s long.
What I did to OnClick event is
  1. Invoke("ChangeScene", 0.5f);
So that the user can see the UIPlay Animation before the scene is switched.

But the problem is, the user can click more than once before the scene is switched.

I can define a local variable to keep track so the button can only be clicked once but I have many buttons in my game so I don't want to define so many variables myself unless it's the only way.

Is there any quick way in NGUI to do this task: Disable UIButton after click
Or I can handle this in any other way?

Thank you.

8
NGUI 3 Support / Wrong hit order of UIButtons
« on: July 08, 2014, 08:33:00 PM »
Here is my setup:
UICamera z = -400
UIButton1 inside ScrollView, z = -120, with Box Collider, UIDrag Scroll View, UIPlaySound
UIButton2 z = -220, with Box Collider, UIPlaySound

Culling Mask of UICamera is Everything
Center of Z of all Box Colliders are 0
So according to the depth, UIButton2 should be triggered if UIButton1 and UIButton2 overlap, but the fact is UIButton1 triggered, why would this happen?

Thanks.

9
NGUI 3 Support / Re: Set initial value for UIScroll View
« on: July 07, 2014, 08:45:01 PM »
Sorry, maybe my question is not clear enough.

I mean I have, for example, 10 UIDrag Scroll View Objects, and I want to stay on, let's say, the 3rd objects when I enter the scene, in stead of the 1st one.

Like when you use ScrollBar, you initialize ScrollBar.value to change where you start at the beginning.

EDIT: Ok, I figure it out myself by using:
  1. scrollView.MoveRelative(new Vector3(x, y, z));
  2. scrollView.ResetPosition();

10
NGUI 3 Support / Set initial value for UIScroll View
« on: July 07, 2014, 02:42:48 AM »
I have an UIScroll View, any way to initialize where I start from? Something like UIScrollbar.value
Thanks.

11
I can confirm that my game has the same problem on iOS (no problem on Android).
I felt strange that a number of people wrote reviews on app store reporting they are unable to play my game and gave my game 1 star, and my colleague accidently discover that it is caused by rotating the device to another orientation

12
NGUI 3 Support / Suitable NGUI scale
« on: June 25, 2014, 11:19:35 PM »
I have objects with scale around 1-10, so I use orthographic camera with size 100. At a result, I need to use FixedSize UIRoot with Manual Height 12 to display UILabel with FontSize 50. Or I use Manual Height 128 UIRoot to display FontSize 500 UILabel.

I feel pretty strange with this and would like to ask if there is anything wrong. Thanks for advice

13
NGUI 3 Support / Re: Click through UIButton
« on: May 11, 2014, 10:53:33 AM »
Don't use OnMouse events. They are not NGUI events.

Attach UICamera to your main camera as well.
How can I not to use OnMouse events if I want to do something like: click on the terrain and command a character to move?
The current issue is that when I click on the UIButton the character will move as well.

14
NGUI 3 Support / Click through UIButton
« on: May 11, 2014, 01:36:38 AM »
Since the UICamera and MainCamera are seperated in NGUI, so if I have some OnMouseDown events for my gameObjects in the scene, they will be triggered even I tried to click UIButtons, any quick way to fix this?

I have tried to add invisible colliders under MainCamera to cover the UIButtons area but it's not effective when the aspect ratio is changed.

Thanks.

15
NGUI 3 Support / Comma in Localization
« on: April 23, 2014, 12:27:38 AM »
How to add comma as content in Localization?

Since the Localization file is CSV, obviously comma is not going to display inside the game through localization. How to make it work?

Thanks.

Pages: [1] 2