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

Pages: [1] 2
1
NGUI 3 Support / Re: 128pt dynamic font limit
« on: October 14, 2013, 08:43:18 PM »
This is a huge showstopping bug for us.

We're using fonts on a 3d camera, and 128px really isn't big enough.
I'm trying to create a font around 160px.
It's for a large display with few characters.

Could you remove this limitation please?

2
NGUI 3 Support / Re: Perspective Camera, Dynamic Font, Force Draw Order?
« on: August 25, 2013, 09:17:21 PM »
Sorry to beat a dead horse, but I've still been trying to get a 3D interface working with NGUI.
With 2D, the way that Depth, Z, UIPanels and Atlases interact is understandable and it's possible to get the order you want.

With 3D, you almost always want a moving camera (why else bother with 3D).
I've seen "draw order is based on Z (position?)" but more accurately draw order is calculated based on distance from the camera (correct me if I'm wrong).

The problem is as soon as you start panning the camera, the distance between your GUI elements and the camera starts changing, and the draw order varies wildly. Things pop behind and in front as the camera pans past them.

Am I missing something? Is there a way around this? It's kind of a dealbreaker here.

3
NGUI 3 Support / Re: Perspective Camera, Dynamic Font, Force Draw Order?
« on: August 22, 2013, 08:38:08 PM »
Thanks for the quick reply!

So I'd duplicate the Font Material for my dynamic font, but instead of using GUI/Text Shader, I'd write my own that has Transparent+1?


Also I experimented, making each UI element have its own UIPanel. I figured I could sacrifice draw calls for simplicity, but each of my elements seems to draw over the other in a seemingly random order, nothing to with Z position.
It seems my understanding of the draw order isn't quite right.

Depth changes drawing order of things with the same material/atlas, within the same UIPanel for an orthographic camera.
Z position sets drawing order for things with different materials/atlases, within the same UIPanel for an orthographic camera.

But then for different UIPanels, perspective cameras...? It seems all bets are off. It'd be nice if this was summarised somewhere in a table...


Edit: It seems I can hack it to draw in the right order by placing extra UISprite elements off-screen, far enough away in the Z order to force things using a certain atlas to draw first. Worst hack of the century but it seems to get the job done for now.

4
NGUI 3 Support / Perspective Camera, Dynamic Font, Force Draw Order?
« on: August 22, 2013, 04:53:32 AM »
I'm making a 3D GUI with a perspective camera.
I have a bunch of UI elements that are on one Atlas, and some labels that use a dynamic font texture.

I've read about the issues involved with multiple atlases, but as I want all the labels to be on top of the UI elements, it seems like it doesn't affect me. I've set the Z positions of the labels so that they're in front of the UI elements.

The problem is, as I tilt and pan the camera by small amounts, the text labels appear and disappear.
This happens in the Scene view too, as I pan/rotate around. I can't work out what's causing it, but there's a magic angle/position where the draw order seems to flip.

Is there a way to force the draw order?
I want the labels to be on top of all UI elements.

5
NGUI 3 Support / Re: Bottom cut off text
« on: August 19, 2013, 03:07:07 AM »
I've seen this in my own work. It was usually because of non-pixel-perfect coordinates or scaling.
Looking at the image you posted, the text seems kind of blurry.
Have you tried hitting the "Make Pixel-perfect" button?

If that text is multi-line, is the line spacing correct?
If it's vertically center-aligned, it might not be pixel-perfect, depending on the number of lines.
You might have to get a script to call MakePixelPerfect() or whatever the function is, after you've set your button text.

6
I might be going insane, but it seems that if I change the spriteName of a child gameobject with UISprite, a UIPanel is added to the parent GameObject. I've searched the NGUI source and not found anything yet, and my tests seem to confirm it...

I'm trying to keep the number of UIPanels down because:
  • Having UIPanels on children within a list breaks clipping in a clipped panel.
  • Because it reduces draw calls.

Is this correct? Is a UIPanel automatically added when changing spriteName at runtime? Is there a reason for this?

7
NGUI 3 Support / Multiple menu panels/screens and transitioning
« on: August 08, 2013, 03:37:45 AM »
I am trying to produce a multiple screen menu system.
Each screen is shown one at a time.
The user is presented with a "splash screen" then if they press the start button, they are shown the "Main Menu screen" etc.

Each screen is a panel with button children.
When a screen is activated, I select the default button on that screen with UICamera.selectedObject

The problem I have is when users press first button, it transitions to the second screen.
Then for some reason when users release the joypad button, the previous menu's button is released, the UICamera's focus is set back to the original (now disabled) button.

  • What is the best practice for using multiple menu screens with NGUI?

8
NGUI 3 Support / UISpriteAnimation and Time
« on: July 18, 2013, 01:33:25 AM »
I started using UISpriteAnimation and noticed that unlike the rest of NGUI, it uses Time.deltaTime and thus is affected by Time.timeScale.
Is this a design decision, or a leftover from something? Is there some other class I should be using?

For now I've made my own UISpriteAnimation that is identical but inherits from IgnoreTimeScale.

9
NGUI 3 Support / Re: NGUI setting UICamera.selectedObject to null?
« on: May 17, 2013, 02:39:57 AM »
The device we're targetting has both controller like buttons and touch input, so unfortunately that's not an option. We need to support being able to navigate via touch and via a controller.

It seems that if I set UIMessage to onPress, the message is sent correctly, but then when I let go of the button, another message is sent which messes up the current selection.

10
NGUI 3 Support / NGUI setting UICamera.selectedObject to null?
« on: May 17, 2013, 02:06:28 AM »
I'm trying to use UIButtonKeys and NGUI, and having weird results still.

Looking through the code, it seems that NGUI calls ProcessTouch after calling ProcessOther, so after pressing Enter on a button to change menus, suddenly UICamera.selectedObject gets set to null, removing the focus.

  1. UICamera:set_selectedObject(GameObject) (at Assets/NGUI/Scripts/UI/UICamera.cs:351)
  2. UICamera:ProcessTouch(Boolean, Boolean) (at Assets/NGUI/Scripts/UI/UICamera.cs:1062)
  3. UICamera:ProcessOthers() (at Assets/NGUI/Scripts/UI/UICamera.cs:995)
  4. UICamera:Update() (at Assets/NGUI/Scripts/UI/UICamera.cs:795)

Why would it be doing this?

It seems to change depending on whether the UIButton that calls my script has a trigger of OnPress or OnClick.
When it's OnClick() only one event is generated when you let go of the key, but with OnPress() it seems to generate a bunch of weird touch events that cause UICamera.selectedObject to be set to null.

11
NGUI 3 Support / Modal Windows and UIButtonKeys
« on: May 16, 2013, 03:55:34 AM »
Our game uses the controller only, and I'm trying to implement modal windows.

When the player presses on a button, I'm displaying a new modal window over the top of the previous one,
and setting UICamera.selectedObject to the button I want selected.
e.g. a classic "Do you want to do this? Cancel / Confirm" window.

The panel is displayed and the default item is selected correctly.

However for some reason when I press Up/Down/Left/Right, the selection on the panel underneath changes.
It's like just the visuals have been changed, but there's logic somewhere that still thinks the button underneath is selected.

  • Is there a way I can stop UIButtonKeys from doing this?
  • Do I need to disable the background panel? I don't want to hide it, just to stop it receiving input.
  • Am I correct in setting UICamera.selectedObject manually throughout my code?

12
NGUI 3 Support / Re: Circular/Endless/Infinite ScrollView
« on: May 13, 2013, 10:25:54 PM »
Did you end up implementing this? Could you share some of your insights and maybe code snippets?

13
NGUI 3 Support / Scene Transition Question
« on: May 09, 2013, 04:26:07 AM »
I'm trying to deal with more advanced animated/fading transitions between scenes.
We have a bunch of scenes, most with NGUI setups.

I've tried some stuff and it seems like a tricky situation.

a) Keep a single NGUI hierarchy between scenes, mark it DontDestroyOnLoad
This would make all scenes other than the first one impossible to play, as they couldn't have NGUI setups present within the .scene file.

b) Add a transition GameObject to the NGUI setup in scene A, fade to black, change scene, then create Another transition GameObject in scene B and add it to the NGUI setup there.
This is tempting, but if we want to do more advanced loading screens with animation, this will not work.

It seems to make a lot more sense to have a single transition object that fades up, stays between scenes, and fades out.

The other problem with this is we'd have to add it to the NGUI hierarchy in scene A, then remove it before the scene unloads, so it doesn't get destroyed,
then add it back to the NGUI hierarchy in scene B.
But it's impossible to tell when a scene loads. Even if you call Application.LoadLevel(sceneName), the line after it doesn't occur after the load.
You'd need some kind of "Find any existing transition objects loose in the scene" script on the NGUI hierarchy, that is activated on OnSceneLoad().
This seems like the best option, but it still Feels wrong.

Ideally I'd have an object that uses DontDestroyOnLoad, and has no parents in the scene hierarchy, but somehow draws over everything.
Is this possible? It seems NGUI stuff draws over Everthing.

Sorry that was a big rambling. I think other people will have simiilar issues with scene transitions, though.

14
NGUI 3 Support / Re: Setting transform.position
« on: May 08, 2013, 03:30:21 AM »
Hooray that seems to work!

Thanks.

15
NGUI 3 Support / Re: Setting transform.position
« on: May 08, 2013, 03:19:34 AM »
I tried changing the code to using AddChild() but I still get the created instance at (-2039.541, 0, -2720).
The prefab itself has coordinates of 0, 0, -10.

  1. currentTransition = NGUITools.AddChild(camera, transitionPrefab);
  2. currentTransition.transform.position   = new Vector3(0, 0, -10); // Make sure it appears on top of everything
  3. currentTransition.transform.localScale = new Vector3(1200, 700, 1); // Make sure it appears on top of everything
  4.  
  5. Vector3 p = currentTransition.transform.position;
  6. Debug.Log(p.x + ", " + p.y + ", " + p.z); // Outputs 0, 0, -10
  7.  

 

Pages: [1] 2