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

Pages: [1] 2
1
NGUI 3 Support / Re: Can't get localization to recognize a CSV.
« on: September 15, 2014, 09:42:41 AM »
Thanks! I'm not sure what happened, but it appears to have been resolved. I had two copies of the localization csv, and even though they were the same, I guess it didn't use the first one, but instead didn't find any, if that makes sense. Working well now, though! Cheers.

Cheers,

S

2
NGUI 3 Support / Can't get localization to recognize a CSV.
« on: September 15, 2014, 03:14:17 AM »
Hey...I've got a localization file that, when I put it in the Resources folder, doesn't get recognized by NGUI, or can't be found in some way. I know the Resources folder is working because I'm using it elsewhere, to load prefabs.

I've never used the localization functions with NGUI before, so I might be doing something else incorrectly. Here's my localization file. Is there anything wrong with it? Why might Unity not be finding it? It's called "Localization.csv".

https://docs.google.com/spreadsheets/d/1SZy-vKIyu1hon74iMbPB7a5S1THv4NlHbW1iwjzDdsQ/edit?usp=sharing

And here is a screenshot of the Unity situation:

http://i.imgur.com/17fn5Au.jpg

S

3
NGUI 3 Support / Re: OnClick not firing in iPad mini?
« on: July 14, 2014, 04:27:05 AM »
Hi, ArenMook!

Thanks again, as always, for your quick response. I'll check this out tomorrow, since I don't have a 4.5 mobile pro license on my current computer. You may be right about the singleton or layering issue. I'm pretty sure _infoView is not null, otherwise it'd show an error message in my on-device-console-message-displaying doohickey.

I use more than one UIRoot per scene because I like to have my UI prefabs as standalone objects -- when I am building a scene programmatically or in the editor, and I drop in (or instantiate) my prefabs, my initial instinct (though perhaps not the right one) has been to store seperate "sections" of my scene under under seperate cameras and UIRoots, because I think of UIRoots and Cameras as working together on a one-to-one ratio. I don't like having multiple cameras in the same location, looking at the same things, if I can avoid it -- it just creates greater margin for error, in my mind. I prefer to have one UI way over here at 100,0,0, and one UI way over there, at 200,0,0. Meanwhile, my Main camera lives at 0,0,0. The reason I feel that way, I guess, is because of the way I think about cameras and locations. I guess it's just what I did without thinking/knowing better. Is it less than optimal, in your opinion?

I fire the OnClick function in scripts on objects (instead of in the editor) for a few reasons:

1) Because I often like to fire OnClick events with custom object types as arguments, and the inspector onclick stuff doesn't seem to allow for that. Don't get me wrong, the inspector OnClick stuff is great for quick and dirty, or just simple stuff, particularly when I was just starting out with nGUI, but I find that I prefer to use programmatic onclick calls 100% of the time, since I know it can handle 100% of my use cases.

2) When I go back through code, I don't want to have to look in the inspector AND in the code for some onclick call, and remember which one I used. I always just check the code.

3) When I'm changing an onclick call in another scene, it doesn't really help to have to go to that scene to change what a button does (if the object with the onclick function isn't on a prefab). I'd prefer to change it in my code -- that way I can fix something without switching between the editor and the code so often.

You are my hero,

Simon




4
NGUI 3 Support / OnClick not firing in iPad mini?
« on: July 11, 2014, 07:30:28 PM »
Hi, everybody!

I'm having a small, but extremely resilient issue -- I have a certain button which refuses to be pushed and fire its OnClick events. It seems like it should be related to the code in the OnClick function, I have some test cases which seem to rule this out:

1. The same code works on iPad and Android, but not iPad Mini.
2. I have tried duplicating the button right next to it, and simply adding the script with the onclick functionality and/or adding it to the delegates list in the inspector. The new button, exactly the same as the old, does not function. The old one still functions.
3. The debug option on the UICamera notes that a the button has been touched, and the button visually reacts to touches (slightly tweens color), but does not fire its onclick. I have placed print statements around it.

My dev environment is a Mac OSX 10.9.3, with Unity 4.3.4f1. I am building with iOS pro, and nGUI version 3.5.7.

Is this possible? Am I on crazy pills?  :'( How can I prove this is happening? Here is the code that I am trying to call in my OnClick function:

  1. public void OnClick() {
  2.                 print ("Fired onclick.");
  3.                 _infoView.CalenderButtonClicked ();
  4.         }

and here is the function that is called as a result of that:
  1. public void CalenderButtonClicked() {
  2.  
  3. //THIS CODE WILL NEVER FIRE.
  4.                 if (DeviceManager.instance._currentDevice == Device_Type.androidPhone || DeviceManager.instance._currentDevice == Device_Type.androidTablet) {
  5.                         DeviceManager.instance.ConfirmLeavingApp("Leave the application to put the wedding date on your phone's calendar? This app might have to reload.", SetCalendarCallbackAndroid, DoNothing);
  6.  
  7.  
  8.                 } else if(DeviceManager.instance._currentDevice == Device_Type.iPadDevice || DeviceManager.instance._currentDevice == Device_Type.iPhoneDevice) {
  9.                         print ("Hello"); //
  10.                         DeviceManager.instance.SetCalendarDate(_weddingInfo._calendarEventTitle, _weddingInfo._startDate, _weddingInfo._endDate);
  11.  
  12.  
  13.                 }
  14.  
  15.         }

I do have more than one UIRoot and UICamera activated at one time in the scene.

Ahhhhh! Oh no.


5
I certainly hear you on the new anchoring system, but I find it dreadfully confusing and dangerous-seeming. It seems to throw things into strange places, and shrink them as they move. I've watched a few videos on it, but whenever I use it, things get confusing. I'll try to create a video and post it here, so I can find out what I'm doing wrong!

6
NGUI 3 Support / Re: Alpha 8 UITextures to save space?
« on: July 11, 2014, 05:54:49 PM »
Thanks! That was exactly what I was looking for.

Cheers,

Simon

7
NGUI 3 Support / Alpha 8 UITextures to save space?
« on: July 02, 2014, 12:53:23 AM »
Hi!

I'm working on an app for android and iOS. Memory and texture sizes are a problem -- whenever the app goes into the background, it has to restart, because Android kills the process (it takes up too much memory), so I'm looking at alternate ways of storing the textures in memory. I came upon an idea.

I'm working with an NGUI UITexture, for example, that is 1024 x 238. At RGB24, it's 1.7mb. If I switch the compression to Alpha 8, it shrinks down to 446kb. Huge drop! It's ok, too, because the texture is only white and alpha. So technically, no data has really been lost. However, The white that was in the image is now black -- and I can't seem to figure out a way to tint it (back to white), in NGUI. So, two questions:

1) How do you tint a UITexture that is in alpha 8 format? Is this possible?
2) Is this really going to save on the texture's size in memory, on a device? How would I check that? (Sorry, not NGUI question).

Cheers,

Simon

8
I found a workaround, which was adjusting the orthographic size of the ui's camera based on the width/height of the screen. This caused the scroll view to appear larger, but to still function in the same way.

Hooray? Hooray! I think. Although I'd still be interested to know how it was meant to be done.


9
NGUI 3 Support / Expanding things next to each other to fit screen.
« on: June 15, 2014, 09:15:03 PM »
Hi there!

So I've got a grid of photos, as I mentioned in a previous post. Currently it looks like this:

http://imgur.com/dWYaWLk

The goal is for these images to expand to be larger based on the screen's width, while maintaining some reasonable spacing in between. Is this something that UIStretch can help with? Can Scroll Views expand their contents based on screen size? or should I modify the sizes of these items on my own?

Cheers,

Simon

10
NGUI 3 Support / Re: Turning off UIAnchors at runtime.
« on: June 15, 2014, 09:01:47 PM »
Thanks, ArenMook! That was it.

11
NGUI 3 Support / Turning off UIAnchors at runtime.
« on: June 13, 2014, 05:03:58 AM »
I'm trying to figure out the correct way to turn off UIAnchors at runtime. I've tried assigning null to the anchorpoints' targets as such:

  1.                 _widget.updateAnchors = UIRect.AnchorUpdate.OnEnable;
  2.                 _widget.rightAnchor = null;
  3.                 _widget.leftAnchor = null;

But this results in an error that seems to occur in the update function. The error states:

Quote
NullReferenceException: Object reference not set to an instance of an object
UIRect.get_isAnchored () (at Assets/FromAssetStore/NGUI/Scripts/Internal/UIRect.cs:261)
TweenPosition.set_value (Vector3 value) (at Assets/FromAssetStore/NGUI/Scripts/Tweening/TweenPosition.cs:41)
TweenPosition.OnUpdate (Single factor, Boolean isFinished) (at Assets/FromAssetStore/NGUI/Scripts/Tweening/TweenPosition.cs:60)
UITweener.Sample (Single factor, Boolean isFinished) (at Assets/FromAssetStore/NGUI/Scripts/Tweening/UITweener.cs:335)
UITweener.Update () (at Assets/FromAssetStore/NGUI/Scripts/Tweening/UITweener.cs:242)
UITweener.Start () (at Assets/FromAssetStore/NGUI/Scripts/Tweening/UITweener.cs:158)

And points to the targets of the anchors being null, it seems.

The reason why I'm doing this (or trying to) is because I have a bunch of photos laid out in a grid -- I'm using a scrollview and adding horizontal rows of photos as prefabs. In order to keep the photos at a good distance from each other, regardless of screen size, I'm using anchors to get them seperated from each other at start. But the user has to be able to cause the photos to go full screen, and if they're anchored (even if it's only anchoring on enable), the tweening to a full screen size acts funny. So I'm trying to start with an anchored UITexture to get the positioning correct, but then turn them off. Here's what I'm trying to accomplish -- I've got it laid out, but it doesn't work correctly because of the anchoring issue, I think.

http://imgur.com/KPEy4aG

Am I going about this in the right way? And if so, how can I turn off the anchors?


Cheers,

Simon

12
NGUI 3 Support / UIGrid Coverflow Style.
« on: May 12, 2014, 09:05:06 PM »
Hey, So:

I'm attempting to create a coverflow-style UI Grid. Things are going well, but I'm having trouble adjusting the x positions of the things in the grid so there is more space in the center for the item that's being focused on. Right now, the items to the left and the right crowd around the middle item, as so:

http://imgur.com/3zjduax

I'm doing this by using the UIGrid class as a base class, and overriding the Reposition function. Basically, after it's done repositioning, I nudge the rotations and z positions of the objects to get the desired effect. However, whenever I attempt to modify the x position of the item, I get nastiness -- the photos either get stuck in the middle, or they move way off screen. Here's the function, called AdjustPosition, that I'm using to create this effect. Is there something in UIGrid that would prevent me from moving items around after Reposition() is called?

  1. public void AdjustPosition(Transform childBeingAdjusted, GameObject middle, int middleInt) {
  2.  
  3.                 //first determine the depth of the items, so the middle one is always on top.
  4.                 int childNdx = int.Parse (childBeingAdjusted.name.Split ('_') [0]);
  5.                 int intDiff = childNdx - middleInt;
  6.                 float offset = _distanceToStartStacking;
  7.                 if(childBeingAdjusted == middle.transform) {
  8.                         childBeingAdjusted.GetComponent<UIWidget>().depth = 0;
  9.                 } else {
  10.                         childBeingAdjusted.GetComponent<UIWidget>().depth = Mathf.Abs (intDiff) * -1;
  11.                 }
  12.  
  13.                 //now, get information about how far off the center of the screen the objects are.
  14.                 ScreenEdgeDetector.instance.UpdateScreenEdgesPersp(Mathf.Abs(middle.transform.position.z - _camera.transform.position.z));
  15.                 float screenEdge = ScreenEdgeDetector.instance._topLeft.x;
  16.                 float lengthOfHalfScreen = Mathf.Abs(_camera.transform.position.x - screenEdge);
  17.                 float percentOffCenter = (childBeingAdjusted.transform.position.x - _camera.transform.position.x)/lengthOfHalfScreen;
  18.  
  19.                 //now, adjust the x and z positions.
  20.                 Vector3 pos = childBeingAdjusted.position;
  21.                 pos.z = _zOffsetCurve.Evaluate(Mathf.Abs(percentOffCenter)) * _moveBackMult;
  22.         //when I comment out this line, the z positioning works fine. but when I put it in, everything breaks. 
  23. pos.x = _xOffsetCurve.Evaluate(percentOffCenter) * _moveSidewaysMult;
  24.                 childBeingAdjusted.transform.position = pos;
  25.         }

13
You're the man, once again. I will name my children after you. Their names, in order of birth, will be:

ArenMook,
CodeSlayer,
and Savior.

That is all.

14
Hi, everybody!

I'm trying to create a chat window where if the user wrote a longer string, the label would overflow to resize the height freely, so that if the user typed:

  1. This is my question, I am writing a question, I am writing a question

It would appear on seperate lines, as such:

  1. This is my question, I
  2. am writing a question,
  3. I am writing a question

And, as in the chat window example, it should not submit the message unless the user presses the return key.

However, the Chat Window example and other examples haven't shown me how this works. The Chat window example's UIInput's label seems to keep switching back to Shrink Content whenever I try to change it, and when I turn on the "Resize Height" overflow option with a UIKeyBinding set with the keycode to "Return" and the action to "Select", it just makes a newline in my chat window -- it doesn't seem to work. It seems to me that UIKeyBindings don't work on UILabels when the overflow style is not set to clampcontent -- because when I set it to clampcontent, hitting enter DOES actually submit it properly with the return key.

So, to be specific, my questions are:
1) How can I create a UIInput that submits when the user presses enter, but which has ResizeHeight set as its overflow option?
2) What do "Select" or "PressAndClick" mean, when we're talking about UIKeyBindingActions? I don't know what it means to select something in NGUI. Does it mean to "Submit"?

Cheers, thanks for your help, here's to a great product.

Simon


15
NGUI 3 Support / Re: Fading in UIGrid items?
« on: May 07, 2014, 02:13:18 AM »
Thanks! I got it a while ago. I wasn't aware that I could use Tween____.Begin on things.

Thanks!

Simon

Pages: [1] 2