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

Pages: [1]
1
NGUI 3 Support / Re: Setting resolution at runtime makes sprites disappear
« on: September 08, 2015, 09:58:01 PM »
Ah okay.

So your standalone build in 5.1 was working fine, and then upgrading it caused a similar problem? I don't remember testing a standalone build in 5.1 so I just want to make sure.

2
NGUI 3 Support / Setting resolution at runtime makes sprites disappear
« on: September 08, 2015, 11:29:01 AM »
I'm running the new Unity 5.2 released today, NGUI version 3.9.2.

In the editor, my UI appears fine, even on resolution changes with the anchors properly displacing things. But that's because setting the resolution at runtime through a UI popup list and through code while in the Editor doesn't do anything.

However, when I build and run the game, where this option does change the game resolution and windowed/fullscreen mode, the UI disappears until I resize the game window manually by dragging the window frame with my mouse. (In my code, I set the screen resolution and windowed/fullscreen at runtime when the game opens using saved user settings, as well as allowing it to be set through the UI where the user can choose windowed mode and a resolution which then applies it immediately).

I think it has to do with setting the screen resolution at runtime, because it's actually not displacing the UI and scaling it properly until I manually resize the window.

Do I have to do something special in NGUI to refresh the UI when I change resolution or windowed mode?

3
NGUI 3 Support / Multiple cameras, UI is rendering in wrong camera
« on: August 26, 2014, 03:14:01 PM »
Hey,

I have multiple panels that take care of different things, like 1 panel for scrolling combat text, another for character portraits, etc.

I'm using NGUITools.AddChild to instantiate and parent the UI elements to a container in the appropriate panel.

Like the scrolling combat text elements gets added to a container object in the scrolling combat panel.

They get added to the appropriate container object in the panel, but when I go to check the panel's camera, I see that they're not being rendered by that camera, they're using another camera.

But I have a 3rd panel that NGUITools.AddChild to a parent object in that panel, and they're actually rendered with that panel's camera.

So I'm confused why 1 panel is using its camera and another isn't.


EDIT: I found the issue :

NGUITools.FindCameraForLayer(gameObject.layer);

I used this code to get the camera that belongs to the UI element, and it's getting the first camera, which was the WRONG panel I needed.

A quick fix is just to change the layer of each UI element so they get rendered at the appropriate panels since each panel will have a camera for that layer only, etc.

4
NGUI 3 Support / Re: Drawcall problem!
« on: January 19, 2014, 11:46:39 PM »
Okay I managed to go from 20 drawcalls to 2 drawcalls separating depths of all widgets.

Each parent has a different depth value, but the child sprites share the same depths like so:

Slider 1 - depth 4

Slider 2 - depth 5

Slider 3 - depth 6

Label container - depth 7

but all 6 background and foreground sprites that the Sliders share are same depth values (8 and 9)

and all Labels share the same depth (3)

So as you can see every parent has a different depth value, and each shared sprite or label have the same depth value.

Now they all render in 2 drawcalls (sprites from same atlas + font from same material separately)

Thank you :)

5
NGUI 3 Support / Re: Drawcall problem!
« on: January 19, 2014, 11:37:35 PM »
Do I understand properly that even if, for example, 2 UISliders do not overlap, but are under different parents, giving them the same depth value is still confusing?

Should I literally just change to unique depth values for every single widget I'm using?

6
NGUI 3 Support / Re: Drawcall problem!
« on: January 19, 2014, 11:23:37 PM »
The parents are just invisible widgets though, just containers, and nothing overlaps visually. But I'm going to try to change the parents depth values and see and post results.

7
NGUI 3 Support / Drawcall problem!
« on: January 19, 2014, 10:40:04 PM »
Here's the process:

-I'm instantiating a child to add to an invisible widget acting as a container for the child objects I instantiate using NGUITools.AddChild(..);

-Child object :depth 3
--Container1  :depth 3

 ---Slider A : depth 3
 ---- Slider A background : depth 3
 ---- Slider A foreground : depth 4
 ---- Slider A Label : depth 3

 ---Slider B: depth 3
 ---- Slider B background : depth 3
 ---- Slider B foreground : depth 4
 ---- Slider B Label1 : depth 3
 ---- Slider B Label2 : depth 3

 ---Slider C : depth 3
 ---- Slider C background : depth 3
 ---- Slider C foreground : depth 4
 ---- Slider C Labe1l : depth 3
 ---- Slider C Label2 : depth 3

-- Container2 : depth 3
  --- Label1 : depth 3
  --- Label2 : depth 3

-- Sprite : depth 3

So the child object has 2 containers, 1 for sliders, 1 for some labels, and a separate Sprite.

Everything is depth 3, since they don't overlap each other, except the UISlider foreground sprites because they sit ontop the slider's background sprites are depth 4.

When I open the DrawCalls from the UIPanel, everything is being rendered almost separately, one at a time or sometimes 2 at once.. doesn't make sense to me seeing as they ALL share the same atlas, and all the Labels share the same material.

8
Ahh I see.

Can you tell I'm new to Unity too :p?

Thank you for explaining though, I fixed it.

9
When I add a child with NGUITools.AddChild from a prefab, it's correctly adding but it's not using the same scale numbers as the prefab.

My Sprite prefab has 182, 178 for scale, but when I use AddChild, it didn't show up on the screen even though it worked, so I looked at the clone made from the prefab, and the clone's scale was 1,1.

Is this normal behavior? If not, am I saving the prefab incorrectly?

Right now I have to code the change in scale to the added child's with transform.localScale += a Vector3 with the hardcoded numbers and it works fine but I'm wondering why it won't take the prefab's scale values.

10
NGUI 3 Support / Re: Dynamically add/remove sprites with resizing
« on: June 21, 2013, 04:25:29 AM »
Nevermind I understand now. :)

For those searching for centering children on a grid like I wanted, search the forums for uigrid/table center alignment.

11
NGUI 3 Support / Re: Dynamically add/remove sprites with resizing
« on: June 21, 2013, 03:30:43 AM »
Oh nevermind! UIGrid is in the Scroll View (example 7).

When you said "underneath position children offset by the (number of children * width * 0.5)", I'm unclear what you mean. Could you explain a little bit more please?

12
NGUI 3 Support / Re: Dynamically add/remove sprites with resizing
« on: June 21, 2013, 03:07:28 AM »
This isn't clear to me.

Am I making a grid that I'm resizing depending on the # of its children? I can't seem to find where the UIGrid is, how do I add one?

13
NGUI 3 Support / Dynamically add/remove sprites with resizing
« on: June 21, 2013, 02:40:05 AM »
Hello,

I'm confused about how to do this. I would like to implement a GUI where I can add/remove character portraits in the bottom of the screen, with different positioning depending on how many portraits are available.

If I have 1, it's in the middle, 2 would be side-by-side but centered on middle, 3 would also be centered.

If someone could guide me in the right direction, that'd be appreciated. (I'm new)

EDIT: Would it be simpler to just prefab all 6 positions and AddChild to Panel when I need to change?

Pages: [1]