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.

Topics - Nicki

Pages: [1]
NGUI 3 Support / QoL change for NGUI atlasmaking
« on: July 11, 2017, 02:59:55 AM »
If you change line 112 in UIAtlasMaker.GetSelectedTextures from
  1. Object[] objects = EditorUtility.CollectDependencies(Selection.objects);
  1. Object[] objects = Selection.GetFiltered(typeof(Texture), SelectionMode.DeepAssets);

you can now add all the sprites in a subfolder to your atlas, rather than having to select them individually.

Do bear in mind, that if you have duplicates, it will "crash" the atlasmaker window, so don't select root. This is the same behavior as is now, if you select two sprites with the same name, so not a big deal though.

NGUI 3 Support / Teensy bug in UIGrid with Smooth Tween
« on: May 17, 2017, 07:43:02 AM »
If you have say 9 elements in your grid, and you set the pivot to center (non-TopLeft) and use the Smooth Tween option on the grid, the first element will be put instantly in the Top Left corner.

It looks to be that it measures whether a SpringPosition should be used, before it applies the origin offset.

The quick and dirty fix is to remove the SqrMagnitude check in UIGrid.cs:371 which means the center element will tween from 0,0,0 to 0,0,0, so not a terrible loss.

Misc Archive / Dawnbringer - Made with NGUI
« on: May 30, 2016, 01:24:36 PM »
So, I've been working on Dawnbringer since 2013 and we're finally about to release.

I think we got a gameplay trailer up now

And some more to come in the next few weeks until release on the 16th of June.

It's the most huge project I've been involved with workwise and we're all happy and proud to have made it all the way to release.

If you head over to Toucharcade you can sign up for the beta, if you want to try it now

Otherwise, feel free to ask me anything - I might even be able to answer. :D

NGUI 3 Support / 0.25px offset in geometry from Handles/gizmos
« on: May 30, 2016, 09:15:10 AM »
I've stumbled on a weird issue, where the geometry from NGUI is offset by exactly 0.25px up and left. The gizmos and handles are all correct, but the actual geometry is wrong.

I'm seeing it both in the editor and on devices, since we keep certain things at half res, it seems to get rounded up or something and we get a 1 px see through line on the UI even on fullscreen backgrounds. that shows how it looks.

Now I'm not sure what's going on, but it sure is annoying. Under normal circumstances it would not be seen, but since we're doubling UI size on retina displays it becomes very visible. Any suggestions as to what to do? I would rather not just offset the specific by 1,1 px, as it potentially ruins all anchoring and is just wrong. :)

  1. MissingReferenceException: The object of type 'UIPanel' has been destroyed but you are still trying to access it.
  2. Your script should either check if it is null or you should not destroy the object.
  3. UnityEngine.Component.get_transform () (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/UnityEngineComponent.cs:19)
  4. UIRect.get_cachedTransform () (at Assets/NGUI/Scripts/Internal/UIRect.cs:185)
  5. UIPanel.UpdateTransformMatrix () (at Assets/NGUI/Scripts/UI/UIPanel.cs:934)
  6. UIPanel.UpdateSelf () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1132)
  7. UIPanel.LateUpdate () (at Assets/NGUI/Scripts/UI/UIPanel.cs:1093)

So, after upgrading from an old old version of NGUI, we now get this bug after running the game for a while in the editor. It triggers when we hit the play button to stop the game.

We've upgraded to the newest version of NGUI on Unity 4.3.4f1. Has anyone seen anything like it? Any solutions, hints anything?

After it's broken, then it fires that LogError every time you mess with just about anything - turn off a uipanel or back on, change a widget, resize the scene view.

It may be something we're doing as one of the hacks to get everything to run smoothly in the old version of NGUI, but that's basically limited to calling Refresh on UIPanels when they're activated, and we've tried to comment that out with the same result.

It's really hard to make a test case, because an empty project doesn't do this, which obviously leads me to think we're doing something wrong. :)

NGUI 3 Support / Nicki's Depth Management Tool
« on: October 06, 2013, 07:54:34 AM »
So, I've gotten to a point where my tool is basically finished, but there's bound to be small tweaks to do here and there.

You open it by going into NGUI->Open->Nicki's Draw Call Toolbox.

This is how it looks:

You can set the depth on Panels and groups of widgets that have the same depth.  If you need to seperate an individual widget, you should expand the widget thingie and click the individual widget to go to it in the inspector, and change that there. I ran into som small issues with doing that directly in the tool easily, so that's not in yet.

The colors are set by Panel. That means that all that have the same colors are drawn by the same panel - so if you see something with the same color and same material in multiple places, that could probably be collapsed by moving the depths closer together.

When the numbers are changed, two buttons appear "Apply depth, Reset depth". Doing it instantly while typing caused too many problems with depths with more than 1 digit.

You install it by just putting the attached script into a Editor folder (doesn't matter where). I've decoupled it as much as possible from the rest of the NGUI core, so I don't stumble on side effects (DrawHeader set the GUI.backgroundColor to white, for instance), but I do still use the NGUIEditorTools.BeginContents/EndContents and NGUITools.GetHierarchy.

When you fold a draw call together it works as it does in the individual panels, and it does overlap with those - so if you fold it in the panel, or in my tool the others fold as well.

In this tool, when a draw call is folded, it turns bright red, to indicate that this should only be a temporary state and you should fold it back out again - they will stay folded together until you unfold them, so if you think you have missing references, that might be it.

Anyways, hope you can use it.

Updated link 15th jun 2014 (Unity 4.5+, NGUI 3.6.4+, no guarantees below that)

NGUI 3 Support / Request: Put NGUI in an NGUI namespace for Unity4+
« on: January 28, 2013, 07:36:49 AM »
There are some of the classes the overlap with other things, like 2d Toolkit and also custom code.

It's relatively simple to put a
  1. #if !UNITY_3_5
  2. namespace NGUI
  3. #endif
  4. {
  5. //normal class
  6. //(...)
  7. }

It just needs to be done in every class.

Ok, I've been banging my head against a wall these past two days and I think I have an NGUI bug on my hands.

I have a scrollpanel with elements in, these include a friend picture in a UITexture (downloaded from online).

These UITextures should be able to update while being on the screen.

To test it out, I've made a little changepic script like so:

  1. int num = 0;
  2.         void OnClick()
  3.         {
  4.                 if (num % 2 == 0)
  5.                 {
  6.                         friendPicture.mainTexture = dummyFriendImage;
  7.                         //friendPicture.panel.MarkMaterialAsChanged(friendPicture.material, true); //did nothing
  8.                         //friendPicture.panel.UpdateDrawcalls(); //did nothing
  10.                 }
  11.                 else
  12.                 {
  13.                         friendPicture.mainTexture = dummyImage;                                
  14.                 }
  15.                 Debug.Log("num " + num);
  16.                 num++;
  17.         }

where dummyImage and dummyFriendImage are set to something different in the inspector, of course.

So, my UIpanel has AlphaClipping and I set the UITexture to use the same shader ("unlit/Transparent Colored (AlphaClip)") otherwise it won't clip properly with the default ("unlit/texture").

If the picture is on screen, the change happens in the texture in the inspector just fine, but nothing happens on screen. When I set the panel's Debug Info to "Geometry" and look at the _UIDrawCall for the respective picture, it sill points to the old picture that was set on start up.

If I scroll the picture out of the clip rect, it gets removed and when I scroll it back in, it makes a new one with the new picture. It never changes if it stays on screen.

Is there a way I can force it to update?

I've tried MarkAsChanged on the UITexture and the ones you see in the code above, but none of the do anything. I've half a mind to take all the UIpanel's drawcalls and destroy them, so it can rebuild, but I fear it will backfire on me and either give a frame of blank space or just explode.

Help me ArenMook Kenobi, you're my only hope.

NGUI 3 Support / Touch threshold has a minimum based on screen.height
« on: October 10, 2012, 06:05:33 AM »
I'm talking about line 920 in UICamera
  1. float click  = isMouse ? mouseClickThreshold : Mathf.Max(touchClickThreshold, Screen.height * 0.1f);

I'm wondering if the Screen.height * 0.1f isnecessary, because that means that on a ipad3 or iphone5 I can't have click thresholds lower than 24 and 11 px respectively. It especially causes trouble when I'm doing the UIRoot with manual height, because on ipad 3 (or other ipads) the height is calculated as 512, which means 24 px is quite big, since it's only 384 px wide. :)

I would just change it in UICamera, but then it will break every time I update NGUI - so I was hoping you could either remove it or make a "smarter" solution.


NGUI 3 Support / Clipping performance, hard vs. alpha vs soft?
« on: September 13, 2012, 08:00:33 AM »
I was wondering, has anyone done performance tests on the 3 different clipping methods? Which is the recommended one for iOS / android and is there any remarkable performance difference?

NGUI 3 Support / UIPanel.Refresh() causes nullreference
« on: June 06, 2012, 06:21:36 AM »
If you load a new panel and enable it, then have a helper script run a widget.panel.Refresh you get the following nullreference

UICamera.ProcessTouch()  :925
UIcamera.ProcessMouse() :733
UICamera.Update() : 600

It looks like the panel is broadcasting Update to everything, which evidently is weird when I've just released my mouse in the same frame (screen change). I suppose it should just check if currentTouch is null in there or something.

If you need more details, let me know.

NGUI 3 Support / Request: ManualUpdate of panels/widgets
« on: April 23, 2012, 02:25:05 AM »
I have a request. Because of the script execution "bug" I've encountered earlier (old forums), I've made a modification to NGUI that fixes it.

The problem was that some things tended to only be drawn an update later than it was activated, causing a single frame of empty screen, which is weird in a paged menu.

I've added two methods to UIPanel.cs and UIWidget respectively to get this to activate and draw immediately.

  1. public void RefreshNow()
  2. {
  3.    gameObject.BroadcastMessage("ManualUpdate", SendMessageOptions.DontRequireReceiver);
  4. }

  1. virtual public void ManualUpdate()
  2. {
  3.   if (this.enabled) panel.AddWidget(this);
  4. }

Every time I update NGUI (which is quite often, go Aren) I have to add this again, but since I could see others having the same problem, I want to request that this is added to NGUI (or something of a similar fashion).

NGUI 3 Support / UIlabels and alpha - shader problem?
« on: April 18, 2012, 05:32:19 AM »
When you change the alpha on a text, for instance to fade it out, it tends to fade towards black before alpha-ing out. It does the same on scrollviews with soft clipping.

The actualy color value on the UILabel is still white, but it looks dark grey, no matter the background, that is, it's not fading into the background color. The font atlas I'm using, uses the Unlit/Transparent Colored shader. Is this something you have seen as well? Is there a possible fix to it? (I'm not very good at shaders).

I can post a few pictures to show you as well.

NGUI 3 Support / UIButtonMessage OnPress/OnRelease weirdness
« on: April 17, 2012, 07:09:48 AM »
I'm having a little trouble with having more than one UIButtonMessage on a single button.

I have a button that should trigger a "down" animation OnPress and a "up" animation OnRelease, but having two UIButtonMessage scripts on the button, causes only the oldest script added to the GameObject to be called.

I tried removing one of them, and adding the other again, and it called the other one.

Can't more than one script pick up on the OnPress call?

Pages: [1]