Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: albert on December 24, 2013, 04:52:32 AM

Title: [Solved] Box Collider Issue
Post by: albert on December 24, 2013, 04:52:32 AM
Hello,

I'm using NGUI 3.0.7 f3 and have problems when I use box collider.
I've got a clean scene, create a sprite and create a label as a child to make a button. When I Attach a box collider to the sprite it takes the same size, until here all ok.
When I play the game, the console show that errors:

Invalid parameter because it was infinity or nan.
UnityEngine.BoxCollider:set_center(Vector3)
NGUITools:UpdateWidgetCollider(BoxCollider, Boolean) (at Assets/NGUI/Scripts/Internal/NGUITools.cs:292)
UIWidget:ResizeCollider() (at Assets/NGUI/Scripts/Internal/UIWidget.cs:571)
UIWidget:OnValidate() (at Assets/NGUI/Scripts/Internal/UIWidget.cs:681)
UISprite:OnValidate() (at Assets/NGUI/Scripts/UI/UISprite.cs:293)

and that

dest.radius>=0.0f
UnityEngine.BoxCollider:set_size(Vector3)
NGUITools:UpdateWidgetCollider(BoxCollider, Boolean) (at Assets/NGUI/Scripts/Internal/NGUITools.cs:293)
UIWidget:ResizeCollider() (at Assets/NGUI/Scripts/Internal/UIWidget.cs:571)
UIWidget:OnValidate() (at Assets/NGUI/Scripts/Internal/UIWidget.cs:681)
UISprite:OnValidate() (at Assets/NGUI/Scripts/UI/UISprite.cs:293)

It get solved If in the UIsprite, I desactivate the checkbox "Box Collider : Auto adjust to match".

Is someone having the same problem?

Thanks!!

PD: Sorry for my english :$
Title: Re: Box Collider Issue
Post by: ArenMook on December 24, 2013, 01:14:28 PM
Are you sure you have 3.0.7 f3? That problem was fixed and does not exist in f3.
Title: Re: Box Collider Issue
Post by: albert on December 27, 2013, 06:24:44 AM
Hi ArenMook!

For sure I'm using f3, at least it came with a txt that start with:

----------------------------------------------
            NGUI: Next-Gen UI kit
 Copyright © 2011-2013 Tasharen Entertainment
            Version 3.0.7 f3
    http://www.tasharen.com/?page_id=197
            support@tasharen.com
----------------------------------------------

And donwloaded the files thesame day, hehe :).
I saw in another post that this was solved in that version, that's why i was surprised about this issue :/
Title: Re: Box Collider Issue
Post by: ArenMook on December 27, 2013, 04:17:06 PM
Then I need some more clear steps to follow because I am not getting this by doing the following:

1. New scene.
2. ALT+SHIFT+S to create a sprite.
3. ALT+SHIFT+L to create a child label.
4. Select the sprite, ALT+SHIFT+C to add a collider.
5. Hit Play.
Title: Re: Box Collider Issue
Post by: albert on December 28, 2013, 07:42:46 AM
Hello ArenMook,

Thanks for your answer, from it I have find were it crash :).

If i follow your steps, and have an atlas and a sprite seleted for the UIsprite it works fine.
The problem comes when i don't use an atlas because i only use the UIsprite as a hit zone, if i don't select any atlas and let it to "none" then shows the error.

I'll use the box collider on the UIlabel instead than using it on the UIsprite.

Thanks a lot!
Title: Re: Box Collider Issue
Post by: ArenMook on December 28, 2013, 04:41:15 PM
You should use an invisible widget for hit zones, not sprite. (ALT+SHIFT+W)
Title: [Solved] Box Collider Issue
Post by: albert on December 30, 2013, 04:28:23 AM
Aww! Great!
That's what I'll do :)

Thanks!