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

Pages: [1]
1
Actually invoking ResetAndUpdateAnchors() AFTER setting up the anchors did the job. I was invoking it before. Reset to me means something a bit different the refresh.
But hey. It works. Thanks.  ;)

2
NGUI 3 Support / Widget - anchors relative to parent widget ( from code )
« on: September 06, 2016, 08:54:04 AM »
I'm developing some dynamic gui using preparded templates ( a couple of empty widgets ( 1 to 4 ) anchored relatively to fullscreen rectangle per template ). What I do, is I parent other widgets to those prepared before, setting their relative anchors to [ 0.0, 1.0, 1.0, 0.0 ] to fill whole parent/template widget. I do it from code setting 'target' and 'relative' value. Unfortunately it doesnt work. It seems like everything is setuped right, inspector shows proper values, but the result is wrong. It looks like that the widgets that are nested the most in hierarchy are updated without parents being updated first or something.

For example: when w template widget is set to be in the in the right, top corner and size is setuped to be [50%, 50%] screen soze, and I set it's child to fill it ( target is set to template widget, left is set to left 0, right to right 0, top to top 0, bottom to bottom 0 ), it get size of [100%, 50%] screen, from the middle to the bottom ( so its in the wrong place and two times bigger then it should ) ).

Is there any known bug? Am I doing something wrong? What should I do to make it working properly? Should I call anything after setting targets and relative values? Update mode is set to OnUpdate.

EDIT1:
Oh. And doing the same from editor works fine. Unity shows THE SAME values, but the result is totaly different.

EDIT2:
When I pause the game, remove the anchor target, set it up again to the same value, the values seem to be recalculated ( I have to set all offsets back to 0 as desired ), and everything is in place. I tried to do kinda thesame from code - set anchor to null and the to desired one - but no luck.

EDIT3 - Found hacky walkaround!
I followed your UIRectEditor - since it gives proper results. I've found that when a target is definded UpdateHorizontalAnchor and UpdateVerticalAnchor methods are invoked, and relatives are being set to desired values. So I did thesame. I've copied those methods to non-editor class script and invoked them manually after setting new anchors, and set the relatives to [0, 1, 1, 0] ( as wanted, to fill in the parrent ). It works as desired.

It's clear to me that there is some bug. It should be fixed!

3
NGUI 3 Support / Move ScrollView only if the child is out of the view
« on: November 19, 2015, 03:46:27 AM »
I'm creating some gamepad controlled gui - some grid base panel with items. I'm using ScrollView and UICenterOnChild.CenterOn() for centering content. The prolem is, that I don't really want to center it every single step, but only scroll if the selected item is out of the clipping panel - so to scroll the items pmy one column up or down, not to the center, to avoid viewing the unnecessary gap over and under the contet . Is it possible to do it easily without custom scrolling script somehow?
(I hope that I was clear enough ;) )

EDIT1:
What I forgot to say is that I use custom scripts for carring user input, so I'm not using any default based input, so I cant use default key navigation ngui systems.

EDIT2:
So what I really need is to check is currently selected item "i" is out of the clipping panel, and then move the view one row up/down.

EDIT3 - SOLVED:
Ok. I've calculated the currently selected object offset and checked if it fits in grid offset bound, and the moved the grid if it was necessary. But I'm still wondering if there was any automatation for that.

4
NGUI 3 Support / Re: Expensive delayed cost using TweenScale
« on: November 19, 2015, 03:37:01 AM »
Thanks for the tip but it doesn't work to me. I've added RigidBody to the most top UIPanel in the hierarchy and there is no changes.
How about the GC stuff? Are you going to clean it up it the nearest future?

5
NGUI 3 Support / Expensive delayed cost using TweenScale
« on: November 18, 2015, 09:00:05 AM »
Hey,
 Why do I get "Expensive delayed cost" on:
UITweener.Update(): Static Collider.Move and Static Collider.Modify
on every single update in profiler?

There is also GC Alloc once for a while on UITweener.Update(), which I also don't like.

Pages: [1]