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

Pages: 1 2 3 [4] 5 6
46
NGUI 3 Support / Re: Atlas-update problem
« on: August 05, 2012, 06:53:11 PM »
Use a sliced sprite to display it instead of a regular sprite, and you won't see any blurriness. Furthermore, everything outside the green rectangle is discarded. You need to specify an inner border instead, just like in that picture.

The boarder pixel is still blurry even with a sliced sprite (which I mentioned I am already using). Does this comment in your release notes address the issue?

Quote
- NEW: You can now specify a UV rect for the UITexture if you only wish to display a part of it.

Thanks for the quick replies!

47
NGUI 3 Support / Re: Atlas-update problem
« on: August 05, 2012, 06:14:14 PM »
The image that I added is 9x9. It has a blury edge.
I wanted to crop in to make a clean edge.
I used the dimensions but when the atlas updated, the image was cropped so the blurry edges were back.

Is there a way to drop a pixel off the edge of an image?

I'm not talking about the 9-slice, which might still be needed on top of this. I'm talking about the blurry edge to the image once added to the atlas.

Let me know if some screen shots would help.

48
NGUI 3 Support / Is there any reason to use a panel for visibility?
« on: August 05, 2012, 06:09:26 PM »
Hi,

I noticed SetActive takes a gameobject. Can I just use empty gameobjects for setting branches of my GUI visibility? Is there any reason to to stick to toggling panels?

I think I assumed this would be a good idea because of the Panel Tool (which is awesome by the way, and I will still use it for the big chunks regardless).

Cheers,

- Rafe

49
NGUI 3 Support / Re: Atlas-update problem
« on: August 05, 2012, 03:54:35 PM »
Hi, I was having this issue as well. While this explains it, I am still not sure what I can do.

I created small black and white squares for a lot of GUI filler, such as simple progress bars. I chose 9px by 9px because I figured the edges would be blurred and I would be able to crop in on the atlas. It worked fine until I updated the atlas and my nice clean edges went blurry because the image was reduced to the crop dimensions.

1) Is this the expected atlas behaviour?
2) Do you have any tips on how to make this work?

Cheers,

- Rafe

50
NGUI 3 Support / Re: UISlider Inspector Slider Too Limited
« on: July 31, 2012, 03:24:53 AM »
Our entire project is under version control but importing an update overwrites files. We would want your updates to ensure system stability. I'll just set it via script as a fail-safe; easier than copying the files to a new Type/inspector in this case.

Thanks for the reply.

51
NGUI 3 Support / Re: UIImageButton Disabled Sprite Image?
« on: July 31, 2012, 02:16:00 AM »
Here is the script and inspector.

It would be cool if your atlas sprite drop-down list would include an empty option, so once I sprite is set, it can be un-set. In the case of this button, you can just set the inactive image to anything if it isn't being used.

Please let me know if you are willing to roll this in to the next release. I know I just posted this in another spot but I really can't change 3rd part imports because doing an upgrade will wipe out custom changes. Our project has too many files to risk it. If this will remain as an attachment example, I need to refactor these to a custom type name so importing future updates won't overwrite.

Thanks again!

52
NGUI 3 Support / UISlider Inspector Slider Too Limited
« on: July 31, 2012, 02:08:31 AM »
Hi,

the UISlider inspector limits the steps, but the script doesn't. I needed 25 steps for a progress bar so I had to edit the inspector script.

I think setting this at an even 100 would be desirable, or making it an int field.


I need to know if you are willing to make this change in the next update. Otherwise I'll set this via script so I don't have to worry about an upgrade changing the settings.

This is an awesome feature by the way. I'm using it to make a retro blocky progress bar and it looks great!

Cheers,

53
Funny, as I was falling asleep I realized how easy it would be to do as you suggest. Thanks for the reply!

54
NGUI 3 Support / Re: UIImageButton Disabled Sprite Image?
« on: July 30, 2012, 02:28:46 AM »
Hi Aren,

I found it easier to edit the UIImageButton script ad inspector to add a disabled sprite / behaviour. Would you like it for nGUI?

Implementation details:
  • When disabled is set to true, the disabledSprite is displayed and the hover and click events are ignored.
  • When disabled is set to False, it properly figures out if the hover or normal sprite is initially displayed.
  • The inspector has a "Disabled State" toggle in case the button needs to begin in a disabled state. This updates in Edit mode keeping with nGUI's WYSIWYG

WDYT?

Cheers.

55
NGUI 3 Support / Playing Animation Frames in a Different/Random Order
« on: July 29, 2012, 03:50:04 AM »
Hi,

I need to make two animations out of the same sprite-frames. The first is just the sequence in order, which works fine. For the second I want to play the frames randomly. Is there a way to do this without adding the frames to the atlas with a different name?

Cheers,

56
NGUI 3 Support / PoolManager + UIPanel = Pooled Widgets!
« on: July 25, 2012, 02:06:08 AM »
I just implemented our enemy life-bars and found out two great things...

1) I added a PoolManager SpawnPool component to the same GameObject as a UIPanel and it just works! Awesome! PoolManager, by default, parents everything under the SpawnPool's Transform, which is also what the UIPanel wants. I just dropped my life-bar prefab, set the pool to preload 10 bars and started the game. All the UISliders came in disabled (despawned) and when I spawn one it show up and everything works; still one draw call.

This is really really cool! It means I can add pools anywhere in my UI...flashes, etc, and it is still all one draw call with nothing ever being destroyed, which is huge on Mobile devices.

P.S. I'll add this to the PoolManager example patterns portion of our website and post it to the Unity Forums.

2) Thank you for the how-to, it worked perfectly. I ended up centering the UISlider using startPos.x -= this.bar.fullSize.x * 0.5f;  where startPos i the target position before casting in to the camera viewport space. Someone in the thread mentioned it, but I didn't see it in the posted sample code.

57
You can't. Disabled game objects can't receive events.

You can call methods on disabled components/objects though (I think). Delegates might work, or calling your own method directly from another script. I am pretty sure it works because at the end of the day these are just classes instanced in memory. Their state in Unity is a sort of meta behaviour. Worth a try anyway

58
(I really shouldn't be posting so late at night!)

Great!

It looks like the hit collider is null when the GUI isn't hit. Is this reliable?...because it would be the key for me to detect GUI hits vs non-GUI hits. I tested with this:

  1.         if (UICamera.lastHit.collider == null)
  2.             Debug.Log("Click: ?");
  3.         else
  4.             Debug.Log("Click: " + UICamera.lastHit.collider.name);

It seems to be working... (famous late-night words)

59
I made a mistake. The game object passed to the delegate is always the gameObject passed to Get(). For example ...
  1.         UIEventListener.Get(UICamera.genericEventHandler).onClick += this.OnClickDelegate;
  2.  
  1. private void OnClickDelegate(GameObject obj)
  2. {
  3.     Debug.Log(obj);   // obj is always UICamera.genericEventHandler
  4. }

I had hoped OnClick always provides the collider that was clicked.

There really is no easy way to tell when the GUI is hit, since the generic and fall-through both get an OnClick event. I would have to use two objects to catch each then compare somehow. I'll drop in a workaround for my workaround, using a bool or something  ;).

60
NGUI 3 Support / Re: How to detect if mouse is clicking on NGUI area?
« on: July 24, 2012, 02:54:36 AM »
I figured out the problem I was having with OnClick always being fired even after a drag. The real object being hit for fall-through is  UICamera.hoveredObject. So clicking, then dragging anywhere in the fall-through area, and then letting go, is technically releasing on the same UICamera.hoveredObject. I added my own bool to figure out if there was a drag.

While I'm happy this is taking less code than my old version, it had a steep learning curve that could be removed by giving me a hook in to what is a GUI vs non-GUI hit. Everything has been so easy except for sorting out these events...just my opinion of course.

Pages: 1 2 3 [4] 5 6