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

Pages: [1] 2 3 4
1
NGUI 3 Support / Infinity Scroll
« on: March 18, 2014, 02:37:54 PM »
Hi,

Not a question, I just needed an infinite scroller and couldn't find it so built it myself. I figured I'd share my work.

Please note:
- I tested this with NGUI 3.5.4 r2 only
- All my scroll-items are the same (it's for the credits of my game, which I want to repeat itself infinitely, but also be scrollable). If you want to create an infinite leaderboard or something like that, you'll have to make adjustments.
- I made this in just over an hour, it's not clean code, it works for me though.
- It auto-fills your scrollview, but should work fine without doing that.
- You simply add this InfinityScroll script next to your scroll view component.

Check out the video here:
http://youtu.be/SYeZTMIY7HI

Hope someone can use it or make something more dynamic out of this ;)

2
NGUI 3 Support / Re: Creating SD from HD Atlas
« on: January 14, 2014, 07:38:08 PM »
I'm not directly reducing the atlas texture, I'm reducing the source sprites (that the artist gave to me). Isn't that the concept of getting an SD and HD version (an SD sprite is and HD sprite with half the resolution?)

3
The OnDrag method is based on drag distance (thresholds can be set in UICamera) and unfortunately not on time.

I suppose you could just create a script that stores the onPressTime and onReleaseTime and calculates the deltatime.

  1. float pressTime;
  2. float tressHold = 1.5f; // tressHold = 1.5 seconds
  3.  
  4. void OnPress (bool isPressed)
  5. {
  6.    if (isPressed){
  7.       print ("Pressed");
  8.       pressTime = Time.time;
  9.    }
  10.    else {
  11.       print ("Released");
  12.       float deltaTime = Time.time - pressTime;
  13.       if (deltaTime > tressHold) {
  14.          // You do whatever
  15.       }
  16.    }
  17. }
  18.  

4
I'm actually surprised that items would be disabled on alpha = 0, but I guess I'd solve your problem by adding a script that disables the panel after your alphatween.

5
NGUI 3 Support / Re: UIScrollView position
« on: January 14, 2014, 06:45:34 PM »
Make sure the content of the scrollview is anchored to the scrollviewpanel, not to anything else in the scene. That should solve it.

6
NGUI 3 Support / Re: Checkbox Group on Init Startup.
« on: January 14, 2014, 06:43:50 PM »
You can add the following code to the receiving class.

  1. if (UIToggle.current.value) {
  2.    //Do whatever you wanna do after a checkbox was set to true
  3. }
  4.  

7
NGUI 3 Support / Re: NGUI 3.0.8f7 update issue : currentTouch = null
« on: January 14, 2014, 06:37:49 PM »
From the NGUI ReadMe:

3.0.8 f7
- FIX: UIPanel's "explicit" render queue option should now work correctly.
- FIX: UITweener.Play should behave better with duration of 0.
- FIX: NGUITools.FindCamera will prioritize the Main Camera over others (fix for Unity Water).
- FIX: Null exception fix in UIKeyBinding.

Perhaps it's the Camera-fix?

8
NGUI 3 Support / Re: Scrollview doesn´t work as expected in standalone
« on: January 14, 2014, 06:33:18 PM »
Are you using the Camera scrollview or the Shader scrollview? I had some offset problems with the camera scrollview and nowadays most devices will work with the shader scrollview.

Also, I always set anchors in code when I create new scrollviewItems. One of these options might fix your problem.

9
NGUI 3 Support / Creating SD from HD Atlas
« on: January 14, 2014, 06:25:33 PM »
Hi all,

I just created my SD atlas from my HD atlas, by doing the following.

1) Duplicated & Batch resized all my source images (using OSX Automator)
2) Selected the folder with the resized images in Unity, clicked 'Select Dependencies' & Created new atlas called 'SD'
3) Went through all (it was only 25) sprites in the HD atlas and changed the border of my SD sprites to 0.5 of the ones in the HD atlas.
4) Changed the pixel size in the SD atlas from 1 to 2

This took me 10 minutes and it worked perfectly. Still, I felt like an idiot manually resizing those borders. And of course, whenever I update the HD atlas, the SD atlas will not be automatically updated.

Is there an automated way to do this?

Thanks all.

10
NGUI 3 Support / Re: LateUpdate eating away performance
« on: October 07, 2013, 12:09:14 AM »
Hey ArenMook,

Fair enough - I guess your great support made me lazy.

So concluding, the edit in my post was actually essential.

Removing a widget is fine, it works fine, even in a static panel.

Moving is a different story as widgets can not scale, rotate or translate while in a static panel.

I can work with this. I'll give every building a widget all in one static UIPanel, which I'll disable on tap, while enabling a separate widget (for only that building) which tweens.

Thanks again ArenMook for the great support!



11
NGUI 3 Support / Re: LateUpdate eating away performance
« on: October 06, 2013, 10:40:45 PM »
So I remove on widget and that requires all the geometry of 50 widgets to be rebuilt, correct?

Edit: Remove/move

12
NGUI 3 Support / Re: LateUpdate eating away performance
« on: October 06, 2013, 10:38:17 PM »
Hey ArenMook,

This does not seem to decrease my drawcalls. Since I'm developing for mobile, 50 extra drawcalls is very expensive. Or am I missing something?

Cheers,

Ivo

13
NGUI 3 Support / Re: LateUpdate eating away performance
« on: October 06, 2013, 10:16:59 PM »
Hey ArenMook,

Yes they are all 50 visible at the same time. Does it matter if they are moving? It's only the camera that's moving (zooming/translating - it's an RTS).

If there's no other solution, I might use images instead of text and do this in Toolkit2D.

 


14
NGUI 3 Support / Re: LateUpdate eating away performance
« on: October 06, 2013, 10:01:14 PM »
So for my problem:

I have 50 widgets in my screen (all from the same atlas)
I want to remove one widget without rebuilding all geometry

There is no options besides having multiple panels which leads to 50 drawcalls, even though the widgets are all from the same atlas with the same z-depth?


15
NGUI 3 Support / Re: LateUpdate eating away performance
« on: October 06, 2013, 09:55:41 PM »
So why does every panel need to be one drawcall? Or doesn't it?

Pages: [1] 2 3 4