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

Pages: [1] 2 3 ... 5
1
NGUI 3 Support / Re: I have a problem with activating widgets
« on: April 03, 2017, 04:34:35 AM »
Does anyone have a simple repro case so I can look at it ?

2
NGUI 3 Support / Re: DynamicFont fix, again
« on: February 27, 2017, 07:15:01 AM »
HashSet is better at checking contains / adding items, but it's worse for iteration.

True. Here you are going to have a lot of checks and a few iterations at the end, why I used HashSet.
Plus, foreach's cost over a for loop is just an overhead (so grows linearly with collection size), while check cost on a list is O(n)...

I also always avoid 'foreach' as it used to leak memory on iOS. I don't know if that was ever fixed.

True, foreach used to leak on iOS. IIRC this is a bug in mono's AOT compiler, so might not be true anymore because of IL2CPP.
But, if it was to be still true, I doubt it would make any big difference here, because that's something that is to be called very scarcely.
On my side, now that I am mostly writing tools, I usually write code using language's syntactic sugar and only revert to more low level constructs on hot spots, but yeah I was found of micro optimisations back in the J2ME era :) (and I've done quite some tricky ones :p ).

I doubt there will be enough labels affected at a time for it to matter either way though.

I guess you are right for most cases, and most people must be using bitmap fonts anyway by now.
But I recall seeing some people here complaining about some issues when they were using lots of labels, so I guess that might still be an issue.

Anyway, forget about all that, I'm just nit-picking :p !

Thanks for your great support.

3
NGUI 3 Support / Re: Texture/Sprite Corners visibility bug
« on: February 16, 2017, 05:58:31 AM »
I may be wrong but I think this is the same as :

  1.     if ((y != 0 || bottomType != AdvancedType.Invisible) && (y != 2 || topType != AdvancedType.Invisible) &&
  2.           (x != 0 || leftType != AdvancedType.Invisible) && (x != 2 || rightType != AdvancedType.Invisible))

So to keep initial form... but it's less readable.

4
NGUI 3 Support / Re: DynamicFont fix, again
« on: February 15, 2017, 11:26:24 AM »
Ho! and by the way, thank you including my patch ;D !

5
NGUI 3 Support / Re: DynamicFont fix, again
« on: February 15, 2017, 11:21:17 AM »
I see you did add a modified version of my patch to NGUI's sources, and I have a question : what benefit do you see using List instead of HashSet ?

From my point of view you should avoid them in that case because each time you add a value you also do a Contains() call to shield against duplicates, so Add() complexity becomes an O(n) operation, whereas while using HashSet everything remains O(1).
Since a scene could have a high number of labels that may impact performances quite a bit.

6
NGUI 3 Support / Re: Backward geometry
« on: January 26, 2017, 06:12:21 AM »
Ok, thanks !

7
NGUI 3 Support / Re: DynamicFont fix, again
« on: January 26, 2017, 05:04:04 AM »
Nice!

As a side note, maybe replacing lbl.MarkAsChanged() by lbl.Invalidate(false) would be better, because it would avoid the cost of processing the text again while that's useless since text did not actually changed shape.

I did not tried on Unity 5 yet. Will do soon and report back once confirmed working there too.

8
NGUI 3 Support / Backward geometry
« on: January 25, 2017, 11:59:30 AM »
Hi !

I updated NGUI to latest version and I'm surprised to see my geometry now is backward.
Looking at git logs, I see commit 4bed6d8 (5th November 2016) does this on purpose.
I may be wrong but I think its wrong, and I'll try to demonstrate here...

You'll find attached a simple project which displays :
 - Sprites facing camera on left column
 - Sprites not facing the camera on right column (which, when you press start, rotates).
 - Top line uses a shader with CullMode Back, so should only be visible on faces facing the camera (left column)
 - Middle uses a shader with CullMode Off, so should be visible on all faces (both columns)
 - Bottom uses a shader with CullMode Front, so should only be visible on faces not facing the camera (right column)

Using revisions before 4bed6d8, that's what happens.
Starting from that commit behaviour is inverted as expected by the code, but IMHO it's wrong.

9
NGUI 3 Support / DynamicFont fix, again
« on: January 25, 2017, 07:27:15 AM »
Hi !

It has been a very long time since I needed to use dynamic fonts but here it is again.
Doing so, I see there is still an issue in current NGUI's version when new characters are added that overflow current font’s texture size : during one frame, garbage can be seen.
I already proposed a patch some years ago that tried to fix that issue, and here I am with a new version based on latest NGUI, which seems to work well, at least in my case :p.

This time, I'll explain all the changes :
 - Label that were marked dirty with MarkAsChanged where not actually updated geometry wise. that's why the issue is still visible in current NGUI -> I added a call to label.UpdateGeometry.
 - Updating labels can lead to new OnFontChanged calls to be done recursively, which would invalidate previous geometry updates, so instead of updating geometry immediately I keep all labels that needs to be updated and only do it once, when we actually exit recursion.
 - For the same reason a label may be updated several times, which is useless. So instead of storing draw calls to be updated, I store labels to be updated, and only do so once for each when exiting recursion.
 - Updating a label’s geometry can cause a OnFontChanged to be triggered because of the UpdateNGUIText call it mades which tries to get font metrics. To prevent that to append when exiting recursion I manually call UpdateNGUIText of labels when I store them for future update.
 - I use HashSets instead of Lists : iterating over them is slower than with Lists but lookups are faster. Since we iterate over them once per recursion exit, and we do lookups once for each label of updated font, it should be better.
 - I pre-initialized them to avoid runtime null check. In the case where we uselessly created them, memory impact is really negligible.


You can try this with the project I attached to this message by following this protocol :
 - before each test, reimport "res/eurofighter/Font Texture" asset, so that all cached data is cleared (sometimes need to do it twice, just check the texture is empty once done)
 - start the application
 - click somewhere in the screen
 - with current NGUI, see there is a glitchy frame (the project sets frame rate to 2FPS when it starts so that you have a chance to see it)
 - with patched NGUI, see there is no more glitchy frame

10
NGUI 3 Support / Re: UILabel disappears (Dynamic font, OnFontChanged)
« on: October 02, 2015, 07:37:26 AM »
That's because OnFontChanged callback is called inside itself, and mTempPanelList is a static list which gets used by different nested calls.
One possible temporarily fix would be to have this list be created inside the OnFontChanged callback.
Final fix would also need to avoid nested OnFontChanged callback calls by reclaiming all used characters at once... I plan to work on this very soon.

11
NGUI 3 Support / Re: Unity 5.2 crash (focus/save)
« on: September 30, 2015, 08:48:04 AM »
I agree with flickering being the best option right now. Maybe the fix of updating panels form the OnFontChanged callback should be removed until a proper one is found : yet another bug has been filled that relates to this problem, this time with Unity 4.6.x.

12
NGUI 3 Support / Re: Unity 5.2 crash (focus/save)
« on: September 29, 2015, 09:58:25 AM »
Aren, I saw your last commit that 'fixes' this crash, alongside a comment that advise stopping using dynamic fonts.

I really appreciate your work but here you are starting to break (the last commit makes labels flicker for one frame with garbage each time a font atlas needs to be expanded) a feature that really is necessary to some of us. Think about Chinese fonts of varying size for unpredictable text, and please tell me if you have better options that dynamic fonts. Standard texture atlases are way to big, distance field improves that a lot but are really a pain in the ... to generate, and does not always generate proper shapes.

I understand you frustration, but please don't break that feature. I'm in the process of trying to find a proper fix so that NGUI can use 'font changed' callbacks the way they are meant to, and hope you will be kind enough to integrate that fix again. I would be very please if we could talk about that privately.

13
NGUI 3 Support / Re: UILabel disappears (Dynamic font, OnFontChanged)
« on: September 29, 2015, 07:16:42 AM »
Aren added this refresh as per my request, because when labels are updated, they are just marked as dirty, and their actual update takes place the next frame.
That was used to cause garbage to be visible during one frame : http://www.tasharen.com/forum/index.php?topic=13414.msg60206#msg60206

Alas this fix triggers another bug due to the use of a single static NGUIText instance everywhere : http://www.tasharen.com/forum/index.php?topic=13479.0
The fix proposed here also has some issues, and there is still no proper solution for this.

Since I really need dynamic font to be working I'm quite interesting in getting it working fine. I'll probably spent some time this week to fix all this once and for all.

14
NGUI 3 Support / Re: Broken Dynamic Font
« on: September 21, 2015, 10:04:07 AM »
I think the repro case I submitted with a solution for the dynamic fonts should expose this problem too.

15
NGUI 3 Support / Re: Broken Dynamic Font
« on: September 14, 2015, 04:27:42 AM »
If I'm not mistaken, you just cached dynamicFont into a local font variable so that it don't get lost.
That should be working, and I'll test that from my side today.

Anyway that hides the problem inherent to NGUIText which is being a static class with lots of public fields accessed from several places with some conflicts, so I hope there is no other problems that will surface because of this.

Pages: [1] 2 3 ... 5