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

Pages: [1]
1
NGUI 3 Support / Trigger Naming Conflict
« on: February 17, 2014, 03:19:22 PM »
Hi, I've run into a problem when integrating NGUI into an existing project. In several places (AnimationOrTween.cs, UIButtonMessage.cs, perhaps others) you have declared a Type named Trigger. In all cases it seems that they are declared in a namespace or nested in a class. In my project I have a MonoBehaviour named Trigger which acts as a helper behaviour for polling the current state of a collider marked as isTrigger. Because your declarations are nested, I don't get a naming conflict error, but all your references to the Trigger classes are naked and end up targeting my Trigger class in the global namespace. I was able to solve my problem by renaming my Trigger class to TriggerBehaviour - not ideal, but it is a path of lesser resistance than altering the NGUI codebase.

My request is that since Trigger is a common name, could you add using statements to the top of scripts which reference the Trigger types to clear up namespace conflicts? For example, in UIButtonMessage you would add "using Trigger = UIButtonMessage.Trigger;".

I understand if this is not a solution you'd like to pursue, but I wanted to throw out my recommendation in case you are willing to accomodate.

Thanks,
- Beck

2
NGUI 3 Support / Re: Runtime widget changes not appearing
« on: February 06, 2014, 12:51:13 PM »
Just wanted to mention, I just upgraded this part of the project to 4.2 and the problem still occurs. One of the main instances of the problem is when I set the alpha value of a parent widget - some of the children do not update until the object is nudged or until I change window focus.

Edit:
After some probing it appears that the mIsVisible variable on the sprites that are supposed to render is getting set to false. This only seems to be changed from UIPanel.UpdateWidgets() when it calls UpdateVisibility on every UIWidget. For some reason, the sprites are being sent "false" to that function, which disables their rendering.
I tested the conditions that generate that false value and it appears that it's caused by UIWidget.CalculateCumulativeAlpha is returning a value less than 0.001 (presumably 0). I'm not sure why this would be the case. I've looked through that sprite's finalAlpha value and all of it's parents up to the UIPanel and they are all set to 1. Could this be an ordering problem? Maybe the sprite isn't receiving its final alpha soon enough?

Edit2:
Although I previously thought you had suggested that I upgrade my Unity version, it appears I am behind on my NGUI version and the changelog indicates that this problem may be solved. I'm downloading the latest now and I'll edit this post with my results.

Edit3:
Upgrading to the latest NGUI version solved the problem. Thanks!

3
NGUI 3 Support / Re: Runtime widget changes not appearing
« on: February 06, 2014, 12:41:52 PM »
Thanks for the response. Indeed, the AddWidget code was an attempt to fix the problems I was seeing.

I've changed my spawn code to use NGUITools.AddChild instead as you've suggested. However, the problem still occurs. Do you have any other ideas as to why this might be happening?

4
NGUI 3 Support / Runtime widget changes not appearing
« on: February 05, 2014, 05:24:58 PM »
Hi, I've been having an issue using NGUI that has been really frustrating. When I make changes to a sprite, occasionally they do not appear immediately. When run in background is disabled, I can trigger an update by switching to a different application and then switching back. However, if run in background is enabled, I must move the sprite to cause changes to appear. Some examples of changes that I am making are enabling/disabling a widget, and changing alpha. I'm using Unity 3.5.7 and NGUI 3.0.9.

The objects where this problem occurs tend to be prefabs which I have spawned. Here is the code I'm using to spawn a prefab into my NGUI environment:

  1. public static UIWidget SpawnPrefab (UIWidget prefab, Transform parent, UIPanel panel)
  2. {
  3.         var instance = GameObject.Instantiate(prefab, parent.position, parent.rotation) as UIWidget;
  4.         instance.transform.parent = parent;
  5.         instance.transform.localScale = Vector3.one;
  6.        
  7.         panel.AddWidget(instance);
  8.        
  9.         return instance;
  10. }
  11.  

Can you discern from this info why I might be having this issue?

5
NGUI 3 Support / Re: NGUI Questions
« on: January 26, 2014, 01:01:35 AM »
Thanks for the response, that works! Yeah, I've been grouping objects where it makes sense but sometimes its not ideal.
It would be nice if in a subsequent version to allow dragging all currently selected objects rather than constraining the drag functionality to one object at a time. The same is true for nudging position values with the arrow keys - if I have multiple objects selected, my expectation would be that all objects in my selection receive the nudge.

6
NGUI 3 Support / NGUI Questions
« on: January 25, 2014, 01:03:26 AM »
I've been using NGUI the past week for the first time and I'm running into a small problem. How do you move multiple sprites at once? If the centroid of the sprites is behind a sprite, the move tool is blocked by the sprite drag, which only affects a single sprite. Dragging the label on the individual position components seems to snap them all to the same value.

Btw, excellent tool so far! I'm really enjoying the workflow of putting these together, and the anchor system is very affective for justifying groups of elements.

Pages: [1]