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

Pages: [1]
1
NGUI 3 Support / Re: NGUI 3.6.2 Stretch a sprite full screen
« on: June 06, 2014, 11:16:53 AM »
Set the Anchors to your sprite to unified, and set Left to Target's Left, Right to Target's Right, Bottom to Target's Bottom, and Top to Target's Top. Then set each number to 0.

That anchors it to all sides and stretches the image to match your view.

Should look like the screenshot attached.

2
NGUI 3 Support / UI Root bounds and anchor bug?
« on: June 06, 2014, 11:10:30 AM »
My anchors all look great when I run Unity, but the moment I stop the build and start editing an NGUI object, they snap to an incorrect position. I can temporarily fix this by going to the "Game" tab and re-selecting an aspect ratio, which seems to refresh the view. The objects snap back to the wrong positions the moment I touch one, though.

I've seen this on a few projects, and would love to know if there's a solution. It makes doing visual layout work very challenging.

The correct preview and layout:
http://screencast.com/t/D3MopjM35BwA

The moment I select an NGUI object:
http://screencast.com/t/gnjXCNrC4pF

A video of the issue:
http://screencast.com/t/NEpUofFjcPb0

Thank you for any help!!!
-Travis

3
Thanks for the replies.

@ArenMook, that's what I wanted to do originally, but I can't seem to find a method called "SetAnchor" anywhere in NGUI. Searching only showed ResetAnchors() in UIRect.

As you say, my original thought was to do something like...

  1. newDialog.getComponent<UIWidget>().SetAnchor(root.transform);
  2.  
...but that method doesn't exist in UI widget! Where should I be looking?

Thanks again!

4
Hi,
I'm using the NGUITools.AddChild() method to dynamically create dialogs from my resources folder within NGUI. The problem is that some of those dialogs need to anchor to the edges of the screen, which I only know how to do by setting the anchors to UIRoot. I can't do that when I'm creating a prefab of a single dialog, since the prefab can't store a reference to my UIRoot instance.

My workaround right now is to intsantiate an entirely new UIRoot prefab with my anchor-requiring dialog embedded in it. This seems hacky to me though, and I'm pretty sure it's causing some touch-event problems I'm having. There must be a better way.

What's the right way to deal with this?

thanks so much,

-Travis

5
NGUI 3 Support / Re: best way to call method from tab buttons
« on: October 18, 2013, 07:44:50 PM »
Thanks so much!! I knew there was a better answer.

6
NGUI 3 Support / best way to call method from tab buttons
« on: October 18, 2013, 07:16:35 PM »
Hi,

I'm creating about 8 tabs, and attaching the UIToggle script to each one. That part is great, but I'm not sure what the best way is to trigger script methods from them.

My instinct would have been to have all my tabs call the same method on value change ("onTabClick"), and then somehow check which tab made the call and perform the appropriate action. I don't see any way to do that, since I can't pass the tab GameObject as a parameter or anything.

Alternately, I could actually create 8 methods in my script, but then updating my tab prefab would reset which method they all call in the editor and force me to set each tab to the corresponding 8 methods each time I change the prefab.

Not sure if this makes total sense, but any advice on triggering actions from tabs or groups of buttons without creating a whole bunch of methods or having to do a lot of Unity Editor legwork would be appreciated!

Thanks, and I'm a big NGUI fan btw!
-Travis

Pages: [1]