Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: wallabie on June 26, 2014, 12:40:52 PM
-
Very strange issue I'm having.
I have a bunch of NGUI panels that I am setting the scale to zero in order to keep them activated while "hiding" them from the user. On the phone, when I ran the app, the FPS went from its normal 22-27 to 2-7 fps. Using the profiler, found that Physics Simulate is eating up the FPS. After testing, I found that having the panels at zero scale was the problem.
Questions:
1. Why is the physics simulate going wild when the scale is zero?
2. Is there another way to hide the panels without disabling them? Reason is that I'm using PoolManager to populate SVs, if the SV is not active then PM doesn't see the already spawned items and keeps on spawning new ones.
-
Because scale of zero is invalid. It causes division by zero, which is a NaN.
-
So what would be the best way to hide something and still make it active.
Would you set the localScale to .0001 ?
-
You can move them out of the way, to some pre-defined "out of the screen" place instead of scaling them down. That's generally what I'd do, since moving a panel is cheap.
Of course, that would mess with things if you have anchors on individual widgets inside that panel that anchor to the screen. I believe if you anchor to a panel without a clip region, it will default to screen size - but I'm not 100 % if that includes position or just size.
-
When I scale something, I don't let it go below 0.01. Due to the low scale of UIRoot, using another small scale value is not advised. Also when you're tweening something from 1 to 0.01, you will not notice any difference between that and 1 to 0.0001, unless you do it very, very slowly.