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.


Topics - Yukichu

Pages: [1] 2
1
NGUI 3 Support / Colliders and Alpha
« on: August 22, 2014, 08:16:55 AM »
Attempting to create "invisible" collider for UI.

Attempt 1:  UIWidget + Collider = fail
Attempt 2:  UISprite (Alpha 0) + Collider = fail
Attempt 3:  UISprite (Alpha 1/255) + Collider = success

I have it working and that's great, just wondering why UICamera.lastHit.collider doesn't register unless there is some alpha there, or am I mistaken?  Didn't change any other settings.

Mmmm... addendum, the panel is set to "Visible" so I am guessing it's checking for a visible component.  Not 100% sure, but this makes sense.  Will have to test more later.

2
NGUI 3 Support / UITooltip and incorrect text size
« on: July 14, 2014, 09:37:31 AM »
So I made a UITooltip and it works wonderfully other than it thinks the text is some weird size compared to what it actually is, causing the background box to be too slim and too tall.  After much brainpower spent, I also realized there were some other on-the-fly type options I wanted for the tooltip, so I ended up adding:

  1.     static public void ShowText(string tooltipText, NGUIText.Alignment align, UILabel.Overflow overflow, Vector4 offset, int width = 0)
  2.     {
  3.         if (mInstance != null)
  4.         {
  5.             mInstance.text.overflowMethod = overflow;
  6.             mInstance.text.alignment = align;
  7.             if (width != 0)
  8.                 mInstance.text.width = width;
  9.             mInstance.SetText(tooltipText, offset);
  10.         }
  11.     }

and I overloaded SetText with

  1.     protected virtual void SetText(string tooltipText)
  2.     {
  3.         SetText(tooltipText, Vector4.zero);
  4.     }
  5.  
  6.     protected virtual void SetText(string tooltipText, Vector4 offsetBorderSize)
  7.         {
  8. ...
  9.                         if (background != null)
  10.                         {
  11.                                 Vector4 border = background.border + offsetBorderSize;
  12.  
  13.  

Granted I'm no code genius, but it lets me set the tooltip's label overflow and alignment to be different as needed, the width of the tooltip when needed, and pad the sides of the background box as needed.

It works great.  I am sure the border thing isn't working 100% as desired, but it works so far.

So the question is, could this be added?  I tried extending the class, but using the static method and mInstance was giving me fits and rather than figure it out I just went with this approach.

Regardless of my lack of knowledge of how to do it properly, having a more customized version of setting the UITooltip text is helpful.

3
NGUI 3 Support / 3.6.6 Scene View Strangeness
« on: June 29, 2014, 02:46:47 PM »
I updated to version 3.6.6 today.

I am using legacy anchors.

Whenever I resize the Scene View window, it adjusted the anchor's position.  Since I work on a laptop without a lot of screen space, I often resize things as needed.  This is driving me batty. 

I change the layout to a different layout, which has different dimensions to that window, and it adjusts the anchor again.  I change it back, anchor position is still wrong.  It's working off of width of the scene view window.  Height does not affect it.  I make it wider, anchor goes bonkers.

I read something about the 'real WYSISWYG' code, and I presume this has something to do with it but... ugh.  Is there an option to turn it off?  Or should I spent a day converting everything to current-anchor code?

4
NGUI 3 Support / UITable Insert
« on: June 17, 2014, 08:20:58 PM »
I've tried and tried to do this on my own, but I've failed miserably, so I'm back to the forums feeling like things either don't work right in my brain, or in NGUI. 

I have a UITable.  It gets filled with stuff.  I want to insert a new object into the next-to-last position.  When I do this, the object always shows up in the last position, unless I leave/return to the table which involves disabling/enabling the gameobjects.

  1.         int index = m_tblCharSelectTable.children.Count - 1;
  2.  
  3.         GameObject child = NGUITools.AddChild(m_tblCharSelectTable.gameObject, m_btnCharSelectNew.gameObject);
  4.  
  5.         mTable.children.Insert(index, child.transform);
  6.         mTable.repositionNow = true;
  7.         //NGUITools.MarkParentAsChanged(mTable.gameObject);
  8.  

It doesn't really matter where I try to put the index if I recall, it always adds it at the last object until I disable/enable the panel.  I'll have to investigate that more, but it doesn't matter if I mark parent as changed, repositionNow, reposition(), whatever...    it's always adding it to the last index.

So I must be doing this wrong.  Advice on how to do this correctly please?

5
NGUI 3 Support / UIPopup List Offcenter and Always First Selection
« on: May 31, 2014, 10:47:25 PM »
Made a UIPopupList, and I populate it dynamically depending on what's happening.  Figured it out.

However, two things I ended up modifying and thought would be nice...

The default drop-down list for selecting which item, options for first, or last, would be great, as my list is empty when it's created. My hacky fix was to just make the first one highlighted always.  It works, but an option for first/last would be great.

Second thing was the popup list is always to right of the mouse when clicked.  I didn't really want to use an anchor and not even sure it'd work since the popup list is appearing all over the screen at different times; however, perhaps a value for 'offset' of the mouse click?  Stuff on the far right of the screen gets cut off if my text is too long, so I just offset the bounds by -20X early on.

t.localPosition = new Vector3(bounds.min.x - 20, bounds.min.y, bounds.min.z);

An actual offset value would be awesome, because you could change it via code depending on the max length of a string in the popup, etc. 

Nothing major, but these would be helpful.  Thanks.

6
NGUI 3 Support / 2D vs. 3D Colliders
« on: May 27, 2014, 09:54:22 AM »
What are the benefits / drawbacks of using 2D vs. 3D Colliders?

2D Colliders
- Faster I presume
- ???

Are you able to 'stack' colliders... probably not efficiently at least, as in have one collider 'on top' of another collider.  I know the 3D colliders you could adjust the z position, or so I thought at one point, to order which one would be 'on top'.  I presume 2D colliders won't do that.

If I change my project to 2D colliders, and I find out everything is a fail, can I easily just switch back to 3D colliders?

7
NGUI 3 Support / Benefits of Unity Sprites vs. NGUI Sprites
« on: May 20, 2014, 10:12:35 AM »
I started watching the videos on NGUI 3.6 on youtube (excellent so far) and there was a large bit about using Unity Sprites instead of NGUI Sprites, and how you could almost get the same draw calls and how to use the automatic atlas builder, etc.

So, I am wondering... what are the benefits of using Unity Sprites with NGUI Widgets?
Are they faster?
They don't seem to be less complex as you stated in the vid the draw calls would be harder to get down to the same with NGUI.
Do they use less triangles or something?
Handles in memory better or some such thing?
Is the atlas builder better, more efficient, handles larger sprite sheets more reliably... or something?
Do they consume less memory?
Anything else?
Will this 'ease' the transition over to Unity GUI?

I like the idea of options.  Is there a good reason why I shouldn't change all my NGUI Sprites over to Unity Sprites, besides that it'd take a bunch of time?

8
NGUI 3 Support / UIInput Caret Manipulation
« on: May 13, 2014, 02:21:10 PM »
I've spent way too much time on this, so I finally am resorting to the forums.   I did try to resolve this myself first :p

I have a UIInput that is disabled.  When a user pressed the enter key, it enabled the UIInput and associated widget for adding text.  Works fine.

I would like to be able to press a different key, have the UIInput be enabled, and that key already be in the input field.  Sounds simple.  I would like this character to not be highlighted, because that's what happens every time at the moment.  If it's highlighted, the next character you type just deletes it, and well, it's like it was never there.

Here's what I've been trying, in various forms.  I looked at what pressing the right/left arrow keys do, and I fail to see the magic of what I'm missing.  Assistance would be appreciated.

  1. else if (!inputChat.gameObject.activeSelf && Input.GetKeyUp(KeyCode.Slash))
  2.             {
  3.                 inputChat.gameObject.SetActive(true);
  4.                 inputChat.isSelected = true;
  5.                 inputChat.value = "/";
  6.                 inputChat.cursorPosition = 1;
  7.                 inputChat.selectionStart = 1;
  8.                 inputChat.selectionEnd = 1;
  9.                 inputChat.UpdateLabel();
  10.             }

So I've tried different order of what's above, messing around with it... and well, enough trial and error, here I am at the forums.  Like I said, it works fine except the character is highlighted when it's added.

Thanks,
Alex

9
NGUI 3 Support / UIInput.cs ProcessEvent
« on: May 13, 2014, 12:59:37 PM »
Please make UIInput.cs method ProcessEvent protected virtual

I love having my own ProcessEvent to use.

Thanks!

10
NGUI 3 Support / [Request] UITextList.cs OnScroll (float val) - make public
« on: February 28, 2014, 01:43:43 PM »
Please make UITextList.cs void OnScroll (float val) a public method so you can scroll the text list via keyboard commands if necessary.

Thanks.

11
Unity 4.3.4f1
NGUI 3.4.6 or thereabouts

Close the window for a webplayer or PC compiled player, and it crashes.  Webplayer doesn't tell me much in the error log, but the PC output_log.txt says:

NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Component:InternalGetGameObject ()
  at UnityEngine.Component.get_gameObject () [0x00000] in <filename unknown>:0
  at UIDrawCall.ClearAll () [0x0002c] in C:\repositories\daedalimperium\DaedalImperium\Assets\NGUI\Scripts\Internal\UIDrawCall.cs:664
  at UIDrawCall.ReleaseAll () [0x00000] in C:\repositories\daedalimperium\DaedalImperium\Assets\NGUI\Scripts\Internal\UIDrawCall.cs:676
  at UIPanel.OnDisable () [0x00062] in C:\repositories\daedalimperium\DaedalImperium\Assets\NGUI\Scripts\UI\UIPanel.cs:728
(Filename: C Line: 0)

I looked at that line in UIDrawCall.cs and it's already checking if the application is playing, so I have no idea.  I am closing the application by hitting the little X that closes like every window.  I've already read about how application.quit() sometimes fails (or used to), but I'm not trying to close the program via script...

Any insight would be great.


12
NGUI 3 Support / OnHover Activates When Window Not On Top
« on: February 12, 2014, 03:56:25 PM »
PC / WebPlayer Build
NGUI 3.4.1 or somewhere around there

I realized that when I put another window in front of Unity Editor, or Webplayer in browser, and put the mouse over an item that should not detect hover (due to another window in front)...  the hover event triggers.  When I say another window in front, I mean like... Chrome, Word, etc.  Not another Unity Window.

I was all worried then I checked for clicking... and clicking does not register, just hover.

Not that big of a deal.  I started writing this thinking someone could click something on a window in front of a running game, and the game interpret the click as well.

Just a FYI.  I don't really need this fixed, unless it's dirt simple and will consume like .00001% CPU.

13
NGUI 3 Support / UIInput (UICamera really) Intercepting Input
« on: November 29, 2013, 05:16:21 PM »
Trying to work around the changes from 3.0.0 to 3.0.6 and somewhere in there I've realized that the UIInput now uses OnGUI to process events.

I was like, ugh, and figured I'd just use a check for the input I need during Update() but... it seems that UIInput (or UICamera really) now intercepts all input as if it were actually using OnGUI or some such thing.  It's the best I can explain it... when I had a giant OnGUI-GUI, when you selected a text field it took precedence for all of the keyboard input, 'intercepting' it from Update() or whatnot.  I'm sure you get the gist.

I am sure I can do ahead and code around it, but... ugh.  Please make ProcessEvent(Event ev) virtual so I won't have to keep changing this every update I suppose.

Thanks.

14
NGUI 3 Support / Nitpicking
« on: October 29, 2013, 02:01:35 PM »
I know this is trivial but... when you update the "Latest Version" thread with a new minor version (3.x.xa / 3.x.xb / 3.x.xc / etc.) could you somehow indicate what has changed in the newest build revision?  I know you used to bold things occasionally for this, but then more revisions happen and now half of it is bolded and I have to remember what is old and figure out what is new.

Maybe a revision/version number for each item when the newest build is posted and addendums/minor revisions are created?

Very nitpicky, I know, but I just neeeeeeeeeed to know what changed... and knowing is half the battle.

15
NGUI 3 Support / Non-Issue
« on: October 09, 2013, 12:36:26 PM »
I had to put this somewhere, and well support for NGUI doesn't have to be negative/issues, does it?

I finally made a chat bubble that follows around a character and doesn't look like total turds. 

I love it.  Resizing the bubble around the text took 2 lines of code.  That's it.  Having the bubble (and text) follow around the transform was fairly simple. 

On top of it all... all the chat bubbles are the same depth, and the UICamera actually draws the last created bubble on top.  By default, the behavior is exactly what I wanted.

Previous attempts:
Unity OnGUI: it worked, but performance was terrible and very difficult to customize.  I had to write about 200 lines of code to word wrap, then try to determine the size of the text with a guicontent, and modify the size of the bubble.  Messy, worked, used OnGUI, hardly ideal.

Unity GUIText with GUITexture bubble: worked somewhat.  Trying to have the most recent chat bubble overlay all others didn't quite work, so having it create 'depth' was an issue.  Following transforms worked, but resizing stuff was a kludgy mess again.

2DToolKit: So I was like, oh hey, atlases and blah blah.  I put a textmesh on top of a sprite and tried having the objects appear in 3D space.  It kind of worked.  My camera is at a 45 degree angle (2.5D game) so the transparent shader on the text wouldn't register correctly for being in front unless it was some huge amount in front of the bubble (.5 Z, which is a huge amount actually).  When people were close to each other and talked, the text from one bubble could be in front of someone else's bubble.  I did end up learning a lot about shaders to try and create my own z-depth offset shader, which let me make it 'closer' and made it mostly work, but it looked like complete garbage.

I had spent, not kidding, about 40 hours on this probably.

I finish up current tasks and decide... let's see what I can do for chat bubbles with NGUI.  It took me about 20 minutes to get a working version.  Ridiculous.  I wish I bought NGUI right when I started using Unity; however, I wouldn't be able to realize how much I hate OnGUI (Guitext/guitexture isn't so bad in places.)

Anyhow, I just wanted to say thanks for this awesome product.  I like that you continue to develop it, providing more value for the same product everyone is using.  I should mention that I have the 2DToolKit and knew he was working on making a UI for it, but just decided to get a more polished product (from much more development time) and paid for NGUI.  I don't regret it one bit.

Feel free to archive this/remove it/whatever once you're done reading it.  I don't want to clutter up the board, but felt I needed to send you some praise and have everyone else read it too.

Pages: [1] 2