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

Pages: [1] 2
1
NGUI 3 Support / Re: nGUI w/ Unity Test Tools
« on: August 11, 2014, 11:29:33 AM »
You are trying to move a parent transform on a child of it and it's not possible.

Thanks, I got it figured it out.  I had the selected when I added the nGUI element, from there I couldn't remove the test from it no matter what I did.  If I made sure I cleared my selection first, it works.

2
NGUI 3 Support / Re: nGUI w/ Unity Test Tools
« on: August 10, 2014, 06:39:22 PM »
I don't know what those are, so I can't tell you.

It is an asset provided by Unity that basically offers NUnit unit testing, customized to work well with unity.

Here is a video of what happens when trying to build a test.  Normally you build a test, then add all your objects and prefabs under the test.  Unity will create the test and create all the objects as if it was a new scene, run the test, clean up and run the next test creating a new scene.  But I have no way of getting UIRoot, camera and the other objects under the test.  It refuses to go in it.

Video: https://db.tt/prUMLFcj

3
NGUI 3 Support / nGUI w/ Unity Test Tools
« on: August 10, 2014, 04:51:44 PM »
How do you make this work?
When I create a test and add a nGUI element, the UIRoot appears outside of the test, and I can't seem to move it under the test.

4
NGUI 3 Support / Re: instantiate ngui sprite
« on: August 10, 2014, 04:48:40 PM »
All NGUI sprites must be a child of a panel, so there has to be a parent anyway. If there isn't one, NGUI will attempt to find it and create one. You should never just instantiate UI elements in the middle of nowhere. If nothing else, then UIRoot.list[0].gameObject can be your parent.

I created float leftBoundsX and rightBoundX that represents the furthest left/right via the camera.  I was then trying to instantiate using random.Range(leftBoundsX, rightBoundsX).  It works fine as Unity Sprite, and these are not UI elements, but I was using UISprite so I can keep it all in one sprite sheet (it's a small game for my 7yo son but good practice).  I was trying to keep everything under UIRoot and using the camera that is built by default w/ nGUI when adding your first nGUI object.

When I use AddChild, I can't seem to create a random start location based on left/right max X at the top of the screen like I want (they drop from the top of the screen downwards).

Right now I changed them back to Unity sprites and it all works perfectly, but I was trying to keep everything under nGUI since it is a 2D game with all sprites, it seems easier if I just keep everything under UIRoot as some things have ui elements even though they are game pieces and not purely gui.

5
NGUI 3 Support / instantiate ngui sprite
« on: August 09, 2014, 05:38:32 PM »
I know it is recommended to use NGUITOOLS.AddChild rather than Instantiate but I'm kind of in a conundrum.

I am trying to make my sprites nGUI Sprites so I can keep my game sprites in one atlas.   I was using Unity Sprite and was instantiating it at top of the screen randomly between left/right of the screen.  When I tried converting to nGUI sprite so I can share the atlas I can't get the behavior to match unity sprites as NGUITOOLS.AddChild requires a gameobject to represent the start position, and I don't want to have tons of game objects at the top of the screen representing many different starting points. 

If I use instantiate it always start at 0,0.
Is there is no way to do this using a nGUI sprite, or do I need to stick with Unity sprites?

Since the game is 2D, I was trying to keep everything under UIRoot and keep them all using nGUI widgets rather than mixing nGUI sprites and unity sprites.

6
NGUI 3 Support / Re: 2D games with ui elements mixed in game
« on: August 09, 2014, 12:18:54 AM »
It depends... do you want your UI elements to mix with your game elements (appear behind game elements, etc?) If so, then you have to go with the 1 camera approach. Otherwise keeping your UI under your UI camera will be cleaner and easier to work with.

I'm not quite sure what you mean by keeping sprites sized for different aspect ratios or only the GUI elements. When the camera's orthographic size doesn't change, screen resolution changes have no effect, and sprites remain the same size proportionally. This is "Fixed Size" option on the UIRoot for NGUI. When it's "Pixel Perfect", then the screen size changes will effectively make your elements bigger or smaller proportionally to the height of the screen.

I strongly advise you to start by following NGUI's tutorials and watching the tutorial videos until you get a hang of all the basics and of how NGUI works.

Aspect ratio changes can be addressed by anchoring widgets.

I've gone through the new tutorials.  But I am still confused by things like having player and enemy objects that have health bars or damage text or other objects in the game scene that have nGUI elements.  This would mean they would need to be under a panel, so it seems easier that you put everything under a panel if there is mixed as it seems to be more confusing to have some things there and some things not when there isn't a strict gui/game separation.  When doing this, would you use nGUI to handle the changes in aspect ratios?  I understand about anchoring, but that's not going to help with objects like the player, and other game related things that have gui objects attached.

7
NGUI 3 Support / Re: 2D games with ui elements mixed in game
« on: August 07, 2014, 12:04:12 PM »
This is highly dependent on the game you're making and there is no one answer to this question. Just go with whatever works best for the type of the game you're working on. Remember, UIRoot is optional -- all you need is a UIPanel to draw the UI elements underneath it.

I haven't even figured out how to do it, so I have no preference.
Should I be fighting to try to get nGUI's camera to work with the default camera, or do I just trash the default camera and build off nGUI's camera.  There are many times I won't have a distinct gui and game, like health bars, and other things.  If I am doing a 2D game should I be using two cameras or focus on one? (I know there are specific cases you need a 2nd camera for specific reasons, but just in general). 

Also should I be using nGUI to keep all the game element sprites (player, enemy and so on) sized for different aspect ratios on mobile, or is that just for the gui elements?

I know there are different ways to do it, but I am not really what works, much less what is better.  I've been playing around with it, but I can't figure out what I should be doing.  Mobile aspect ratio been kicking my ass (and not just GUI, the entire game).

8
NGUI 3 Support / 2D games with ui elements mixed in game
« on: August 06, 2014, 02:30:26 AM »
What is the best practice for building a game that has no clear distinction between UI and Game outside of the menu screens. 

Do you remove the default scene camera and create a UIRoot and put everything under that?
Would you use nGUI to keep your game sprites sized for different aspect ratios?

9
NGUI 3 Support / 4 widgets sharing depth of 1
« on: August 06, 2014, 02:27:44 AM »
I have four sprites in the scene, there is empty game object with nGUI sprite and nGUI Label as separate game objects.  I get a message on the sprite that 4 widgets are sharing the depth of 1.  Same with Labels but complaining about depth 2.

These 4 sprites are prefabs, they are not overlapping so I would expect them to all be instantiated with the same depth.  Should I be changing the depth of each sub object when I instantiate the prefab, even though they are not sitting on top of each other? 

10
NGUI 3 Support / Re: Prefab and UIInput/Label questions
« on: July 31, 2014, 11:15:45 AM »
UIInput will change the color of the label to the "active" color when you start typing or when it has text in it. Label's starting color is the "inactive" color -- color used when the input field doesn't have any text, or when it's displaying the default text (such as "Press Enter to start typing").

No, there is no way to tell if something is pixel perfect. But if it looks blurry, it's a sign. ;)

Ahh ok, UIInput was overriding the settings I was making in label.  Thanks!

Anyway to add a feature that would have an icon if something is pixel perfect?  Maybe even an optional gizmo.

11
NGUI 3 Support / Re: Prefab and UIInput/Label questions
« on: July 30, 2014, 04:56:15 PM »
References within prefabs are only going to be kept if the referenced object is a part of the same prefab. Prefabs are their own self-contained hierarchies.

There are many ways to improve font quality -- use PixelPerfect UIRoot, native font size in labels, ensure everything is pixel perfect (select UIRoot, ALT+SHIFT+P), etc. You will need to be more specific, and pics help.

You can change label's tint color and embed colors, same as any other label, whether it's using dynamic fonts or not.

Thanks, wanted to make sure the prefabs would behave that way. Good to know.

I couldn't change the color using Color Tint, I changed it to Black and I still have white font.  I could change it with Gradient only.
But then I noticed that if I set the color tint to Black and hit play, I have a white font but I further noticed the color tint was changed to white.  I can change the color tint to any color and the font will change, but for some reason the color tint is changing to white when hitting play.  So whatever I set in the inspector for the label, is no used when hitting play.   Although gradient with black/black seemed to stick.

I made a video showing the behavior: https://db.tt/Srt3YpLC

Is there any visual way to tell quickly if a sprite is pixel perfect already without just clicking UI Root and forcing the tree to pixel perfect?

12
NGUI 3 Support / Re: Prefab and UIInput/Label questions
« on: July 29, 2014, 10:40:20 AM »
Labels must be set to "resize freely" overflow, or you should resize them to fill the entire box.

The area you're providing for labels is too small, so the text shrinks by default when it doesn't fit.

I can't use ResizeFreely as I am using an Anchor, I assume clamp is my best bet?

What about the prefab question about notify?   If dragging part of a prefab into Notify for UIInput, will it drag that same gameobject for all copies, or will it know enough to use the gameobject that came with it's prefab?  I assume since it is a prefab, it knows to use it's own copy?

Any way to get the nGUI font to look as good as Unity native?

Is the gradient only way to change the color of Unity native fonts?

13
NGUI 3 Support / Prefab and UIInput/Label questions
« on: July 29, 2014, 01:07:30 AM »
I have a few issues I'm running into when trying to build a crossword puzzle type of game.

I have an empty game object (Square) which has a gameobject w/  nGUI sprite (uisprite, box collider and UIInput) and another child game object with UILabel).

Screenshot: https://db.tt/s8gUz0Th

Right now I am testing four of these making up a 2x2 grid.  Each square will hold 1 character.

1) How to make the font stay the same size.  I found using Unity font gave me the best results (no gradient, max lines 1).  I tried different settings for overflow and each letter is a different size.  j is big, m are tiny.  Since I am using only 1 character, none of the overflow options really seem to make sense, there is nothing that "do nothing" and leave it be. 

2) Change color of unity font, color tint doesn't work, gradient does if I make top/bottom the same, is that the only way to do it?

3) I made the game objects a prefab, i have the 3 game objects listed above saved as prefab.  But I can't figure out how to do certain things.  Like for example when I change the "overflow" type, and click apply it doesn't seem to affect the other 3 prefabs brought into the scene. 

4) Also with the prefab, I am trying to set submit/change for the UIInput, when I drag the parent game object (that has my script) into submit/change and select my funtions and hit apply to save the prefab, is the game object stored in notify the one I dragged there (thus the same for all four prefab instances) or does it know to use the one for that prefab instance?  The prefab is Square (Parent) Sprite (Child) Label (Child) and the script is on Square (Parent) which would be dragged into Notify on the Sprite UIInput.  I want to make sure it uses the correct Square (Parent) for the prefab's instance.  It appears to (i'm setting a public variable in the script and setting it to whatever is in UIInput to make sure they are all unique).  But want to make sure that is the proper way to do it, or do I need to use code and call getComponent to make sure I get the correct parent object for that particular instance.

5) Is there a way to get sharp crisp fonts with nGUI fonts that would be variable size?  It seems like the Unity native ones are much much sharper.

14
NGUI 3 Support / Re: UIInput Question & Unity Remote
« on: July 23, 2014, 12:24:41 PM »
You can make the input box smaller by changing Max Lines to 1 on the label. You can hide it completely by checking the "Hide Input" option on the UIInput.

Hide Input was exactly what I needed.  Thanks!!

15
NGUI 3 Support / Re: UIInput Question & Unity Remote
« on: July 22, 2014, 08:46:57 PM »
Unity Remote sends both touch and mouse events from a single action, which confuses the app. You would have to disable either touches or mouse events on the UICamera.

Is there anyway around the large input text box? 

Pages: [1] 2