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

Pages: [1]
1
I've noticed that NGUI UITooltip module doesn't respect the alpha attribute on the tooltip background sprite. It will always lerp it from 0 to 1, doesn't matter what it was originally. So I made a small change that makes it lerp independently for text and background. As a result, it respects the transparency that is set in the Inspector. For those who are interested, the code is attached.


2
Sorry. Never mind. Found my issue. The face tones were so close to black that neither hover effect nor color tint were visible. I'm stupid  :-[.

3
I'm using the latest NGUI version. I have a button that needs to change face under certain conditions. When I change a face the following occur:

1. Original button hover color does not take effect
2. Sprite's tint does not take effect. Note that without changing the face name - it works fine

Here is my code:

  1.        
  2. GameObject sprite_game_object = button_game_object.transform.FindChild("Background").gameObject;
  3. UISprite sprite = sprite_game_object.GetComponent(typeof(UISprite)) as UISprite;
  4.  
  5. sprite.color = Color.red; //this works without changing a face below
  6. sprite.spriteName = "name from Atlas"; //this changes the face but the color change above gets ignored; the hover effect on the button dissapears as well
  7. sprite.MakePixelPerfect();
  8.  
  9.  

One more thing. I've noticed that if I use a sliced image type on a sprite - after changing a face it get sized correctly. But if i use a simple image type then a new face does not get re-sized. Neither type solves the problem with tint or hover colors presented above.

If anyone has any ideas I would appreciate it greatly.

4
ArenMook - thank you for quick reply and solution.

5
Attached UICamera to my main camera. Change event to OnClick. It works. Only GUI gets the events.

6
Sorry if this is obvious but how do I make sure that NGUI events get propagated to my colliders attached to non-gui objects (seen by a different camera, on a different layer). Does it mean that I also have to attach UICamera to my main camera?

7
No. I don't stack colliders under UI. It is just HUD is sitting on top of the (3d) playing field. Meshes move there (according to a separate game logic - nothing to do with UI/HUD). those meshes have colliders. Right now these colliders react to the click on UI. From my perspective - UI is the closest to the user so only the UI collider should react. It is got to be a relatively common issue.

8
NGUI 3 Support / NGUI Button click vs. click on the underlying mesh
« on: June 20, 2013, 09:17:51 AM »
(Latest NGUI version - 2.6.3). I have a HUD that contains NGUI buttons. Every time I click one of these buttons if there is a mesh (enemy ship ...) under that button and that mesh supposed to react to the mouse click in some way then that reaction gets triggered. Is there a way around that? Is there a way to tell NGUI/Unity to "consume" the click? Or what kind of logic I would need to implement to make sure that clicks intended for my NGUI HUD don't propagate to the underlying meshes?

This looks similar to (I use 2d GUI though):

http://www.tasharen.com/forum/index.php?topic=4713.0

9
Exactly. So my HUD is divided into LeftTop, LeftBottom, RightBottom parts. Some of these parts need to appear/disappear dynamically. Anchors that glue these parts to specific areas of the screen are a logical way of controlling HUD parts visibility.

Anyway. Looks like the problem was resolved in the latest version.

10
Sorry if I wasn't clear. I just use anchors to enable/disable certain parts of the HUD. The labels I'm setting are sitting at various depth under these anchors.

I will upgrade to the latest and see if problem still exist.

11
I have a possible NGUI issue. I'm running version 2.5.1 (paid). I have 3 anchors defined under my 2d root. One of them is disabled by default. It gets enabled and filled by information after mouse hovers over one of the meshes in my game. So, I activate the anchor and immediately in the same method set a whole bunch of labels that are sitting (indirectly) under that anchor. I made sure that game knows not to keep updating labels every frame after they were updated once. I've noticed that screen doesn't reflect the information I put in there. I decided to delay filling the labels by one frame after anchor gets activated. And everything started to work. It looks like any changes that are done in the same frame when anchor gets activated are ignored.

I apologize if this was posted previously. I did search the forum and couldn't find anything.

Pages: [1]