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

Pages: [1] 2
1
NGUI 3 Support / Re: Best Way To Do Page Turning Mechanic
« on: July 22, 2015, 10:19:29 PM »
I hit a snag. I created the "staging area" offscreen and setup my page with several UI elements.

I figured I could take a screen grab on a staging area camera and get all the UI elements baked into a single texture which I could apply to the bottom page mesh. Idea being, when the top page mesh peeled away, the underlying page mesh would be revealed.

Problem is, after creating a duplicate UI root and camera, whatever is in the camera view shows up in the game viewport regardless if it is far away from the other cameras in the world.

I'm still a newb. Does anyone know how to do what I am trying to do?

Essentially, I want the camera to render to its own viewport that does not get added to the game viewport and allows me to take a screen cap of using readPixels()

2
NGUI 3 Support / Best Way To Do Page Turning Mechanic
« on: July 22, 2015, 10:15:59 AM »
I'm looking for the best way to accomplish page turning in a book app.

A Page is:
Background image
UI elements

There is a top page mesh which animates and a bottom page mesh.

Here is my idea for the top page:

1. Player hits NEXT
2. Generate screen cap using readPixels(). Bakes UI and background image into one image.
3. Apply screen cap texture to top page mesh
4. Disable actual UI elements so they're hidden during page turn.
5. Trigger the page turn animation. Everything on the page "curls" nicely with the page.

Idea for bottom page:

1. Player hits NEXT
2. Offscreen in a "staging area" I create my page with a dummy camera
3. Generate screen cap using readPixels(). Bakes UI and image into one image.
4. Apply screen cap to bottom page mesh
5. The TOP page mesh animates away revealing bottom page
6. Enable the UI elements.

What do people think about this idea? Is there a better way to handle this?

3
NGUI 3 Support / Alpha Setting?
« on: January 06, 2015, 12:03:20 AM »
Hi, I may be missing something, but I can't seem to find how to set an object's alpha value.

Do I have to use an alpha tween (like in the code below)?

Also, how do you get an object's current alpha value? Is there an easy accessor?

Lastly, is there any input gating during a tween? I.e. can the player still hit the button during the tween to alpha 0?

Thanks!

  1. // Set the BackBtn's alpha to 0 since we are on the main menu.
  2. TweenAlpha tweenOn = TweenAlpha.Begin (mBackBtn, 0.0f, 0.0f);
  3. tweenOn.from = 0.0f;
  4.  

4
NGUI 3 Support / Re: Component Execution Order
« on: December 30, 2014, 04:20:51 PM »
Ok so I went to: Edit -> Project Settings -> Script Execution Order

I didn't see UILocalize on there so I added it to the list. I also added my WordHighlight script below that. That seems to have fixed my issue, so thank you.  :)

So to clarify, does the order of the components (top to bottom) on a game object matter at all in terms of execution order? Unity lets you move components up/down and reorder them. What is the use in that if it doesn't affect execution order?


5
NGUI 3 Support / Re: Component Execution Order
« on: December 29, 2014, 04:27:30 PM »
As a sanity check, I deleted the label where the UILocalize executed AFTER my highlight script. I copied the label which worked correctly (had UILocalized execute before my highlight script).

I figured that undoubtedly I would see consistent behavior at that point, but again, I saw that one label had UILocalize get called before the highlight script and one label had UILocalize get called AFTER the highlight script.

[scratching my head]

6
NGUI 3 Support / Component Execution Order
« on: December 29, 2014, 04:14:20 PM »
Hi, I am still a unity newbie.

I have a "Highlight" script that runs and grabs the text from a label and creates a duplicate "highlight" label over it. The Label makes use of UILocalize. Unfortunately, I'm seeing in one label UILocalize gets called BEFORE my script and in another label instance UILocalize gets called AFTER my script.

If it gets called AFTER my script, then my Highlight script doesn't work because it is copying whatever contents were in the label before the UILocalize got called.

In both instances, my highlight script component is BELOW the UILocalize component in the inspector, which I thought would ensure execution order.

Is there something I am missing?

7
NGUI 3 Support / NGUI Showing Twice
« on: December 20, 2014, 03:05:38 PM »
Hi, I must have done something stupid and messed up some settings. My game now shows NGUI twice. I believe its showing once in the UI camera and once in the main camera. I messed around with the size of the main camera so now it is slightly offset from the UI cam. The result is that I am seeing all NGUI elements twice (slightly offset from one another).

Any idea what I need to do to fix this? Something to do with culling settings on main cam?

thanks.

8
NGUI 3 Support / Re: Anchoring to Screen Dimensions
« on: October 29, 2014, 10:00:59 PM »
thanks for responding.

In this case, I actually don't want it to anchor to the left/right, just top.

That example was very helpful, I should have thought to review that again.

The anchor system has a really steep learning curve, IMHO. It seems straightforward until you start using it and considering how it will react on each of the platforms. IDK, maybe my thought process is just coming from a totally different place.

9
NGUI 3 Support / Anchoring to Screen Dimensions
« on: October 26, 2014, 03:00:27 PM »
Hello,

I am wondering if there is a way to anchor to screen dimensions instead of widgets in the scene.

Specifics:
UIRoot Content dimensions are 2048x1536.
Both "Fit" boxes are unchecked so clipping will occur (desired behavior).
My game layout will be landscape mode.

On the iPad (4:3), there is no clipping, on the iPhone5 (16:9) there is clipping at the top/bottom of the screen.

If I anchor a widget at 10% from the top of a 2048x1536 image, then everything is cool on iPad. However, this widget will be cutoff on iPhone5 because the UIRoot settings cause clipping on the top of the screen.

What I really would like to do is anchor my widget to the screen dimension (so 10% of 1536 on iPad4 and 10% of 640 on iPhone5). The result would be that I would get the clipping of the background image that I want, but the other widgets would position themselves so they don't get clipped.

 Is there a way to do this or do I have to write my own script?



10
NGUI 3 Support / Re: Best use of Atlases?
« on: October 15, 2014, 07:38:22 PM »
Ok, yeah, I guess that makes sense.

However, my textures will be 2048x1536. I was thinking that it would be good to use the atlas so that it would force it into a square texture, but the padding wouldn't need to be part of my texture per se. You see, I am working with a mac and targeting iOS which requires square textures.

Here are the options I see:
- Put the non-square texture into an a square atlas
- Stretch out my source image vertically so it takes up a square texture and then squash it back down once in game.
- Pad the source image with 0 alpha from 1536 to 2048.

What would you all do in this situation?

11
NGUI 3 Support / Best use of Atlases?
« on: October 14, 2014, 07:10:51 PM »
Hi,

I am making a story book app. Essentially each page will contain an iPad4 size (2048x1536) image. There will also be text.

How would you guys implement this in regards to Atlases?

Should each page be its own atlas? So 30 pages would mean 30 atlases?

Should each of these Atlases be in a Resource folder and loaded dynamically at run-time?

Thanks!

12
NGUI 3 Support / Re: Purpose of Reference Atlas?
« on: October 14, 2014, 07:07:21 PM »
Ok, thanks for your explanation. I am somewhat of a noob in Unity, but based on my UI experience, maintaining multiple atlases seems like it would open the door for a lot of bugs. E.g. "oh I forgot to update the sprite on the other atlases when I made that character change."

Ideally, the UI can just scale down appropriately and work on all the devices that I am targeting, without additional specialization. I'm hoping that will look fine on smaller devices.

13
NGUI 3 Support / Purpose of Reference Atlas?
« on: October 11, 2014, 03:15:48 PM »
https://www.youtube.com/watch?v=dbwgP6PC4go

I watched the link above which explains references atlases.

Is their purpose to reduce the run-time memory footprint and reduce the number of pixels being processed on lower end devices (thus increasing performance)?

If I ship a game with multiple versions of the same atlas (SD, HD, ultra HD), then those textures are all going to take up hard disk space, so that actually is a negative because it increases the app's size.

My plan for my story book app was to just make one atlas with everything at iPad 4 size and then let NGUI just scale all the elements down for iPhone4, iPhone5, iPad2, iPad3, iPadMini.

My app is pretty simplistic (background image and text on each page) so I'm thinking perf won't be a huge problem.

Is there a good reason why I should abandon my plan and go with reference atlases?

14
Hello,

My class PaganationDotBar inherits from UIProgressBar and is assigned to be the horizontal scrollbar on a scroll view.

UIProgressBar has a property "value".

Without modifying the NGUI class UIProgressBar, is there a way for my inherited class to be notified when that value changes?

I tried the following:
  1. public override float value
  2.         {
  3.                 get
  4.                 {
  5.                         return base.value;
  6.                 }
  7.                 set
  8.                 {
  9.                         base.value = value;
  10.                         Debug.Log("Got there!");
  11.                 }
  12.         }

However, I cannot override the property because it is not marked as virtual. The other option would be to add a callback to the onChange event delegate array, but that seems strange because that seems like it would be used to notify outside objects, not one which inherits from UIProgressBar.

What would you do here?

Thanks!

15
NGUI 3 Support / How to set path to localization file?
« on: September 21, 2014, 02:45:25 PM »
Hi, noob question here, how do I set the localization file path so that it is recognized both while in the editor and in-game?

Right now it points to Resources/Localization. I had to delete both NGUI/Resources/Localization.csv and NGUI/Examples/Resources/Localization.txt in order to get my own csv file in a new Resources folder to actually take.

I guess what I am asking is how would I get the game to read from MyProject/Resources/Localization/myLocFile.csv?

thanks

Pages: [1] 2