Author Topic: UIDraggablePanel Crash in Android  (Read 11944 times)

kaede

  • Guest
UIDraggablePanel Crash in Android
« on: June 05, 2012, 02:22:22 AM »
I set up a draggable panel in my UI, and items which contain draggablePanelContents will be spawned at runtime, those item will be add as children of this panel, Everything is ok within Editor, but got crash in Android while I drag it, no any error information provided by adb logcat, application is totally stuck only to pull out battery can reboot my phone, Any idea about that?

joreldraw

  • Guest
Re: UIDraggablePanel Crash in Android
« Reply #1 on: June 05, 2012, 03:16:32 AM »
I have same in my app with element spawned in runtime and for me all work fine.
Tested on Galaxy Tab 10.1 and Xperia X10 without any problem.

I think the problem is not from NGUI

kaede

  • Guest
Re: UIDraggablePanel Crash in Android
« Reply #2 on: June 05, 2012, 03:49:50 AM »
Mine is LT15i, the hierarchy seems like:
Root(UIRoot)
-- Camera(UICamera)
-- -- Anchor(UIAnchor)
-- -- -- ColumnGroup (UIPanel, UIDraggablePanel)
-- -- -- -- IconColumn( Custom Script, it will change sprite Name or active/deactive children of this gameObject )
-- -- -- -- -- circle ( UISprite, Tween Color, this object will be attached or detached dynamically by touch inputs )
-- -- -- -- -- -- icon1 ( UIButton Color, UIButton Scale, UIButton Offset, UIButton Sound, UIButton Message, UIDragPanelContents, Custom Script: it is only handle data )
-- -- -- -- -- -- -- Background ( UISprite )
-- -- -- -- -- -- -- Label ( UILabel, without font presets )
-- -- -- -- -- -- -- lock ( UISprite )
-- -- -- -- -- -- -- pointD ( UISprite )
-- -- -- -- -- -- -- pointL ( UISprite )
-- -- -- -- -- -- -- pointR ( UISprite )
-- -- -- -- IconColumn ( Same as before )
-- -- -- -- IconColumn ( Same as before )


BTW: all UISprite using the same Atlas while a font using another one.


joreldraw

  • Guest
Re: UIDraggablePanel Crash in Android
« Reply #3 on: June 05, 2012, 03:54:06 AM »
My hierachy is so much long... about x20 and i have about 6 dragable panels.
Try Off all except your dragable panel to check if the problem persist.
Off too all script and check to catch if problem is NGUI or your script

kaede

  • Guest
Re: UIDraggablePanel Crash in Android
« Reply #4 on: June 05, 2012, 04:37:49 AM »
Thanks man, I just take out all logic i wrote and only add a empty GameObject attach a test script that spawn an empty item blow this panel, it's still crash for my phone ( Sony Ericsson, XPERIA, LT15i, Android 2.3.2 ). However, i add item statically in editor and it runs prefect, I've no idea since there is no hint in android log.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel Crash in Android
« Reply #5 on: June 05, 2012, 05:57:28 AM »
Android 4.0.3 has issues with Unity 3.5.1 that 3.5.2 fixed. They're the only sources of crashes I'm aware of.

kaede

  • Guest
Re: UIDraggablePanel Crash in Android
« Reply #6 on: June 06, 2012, 03:13:21 AM »
Hey man, I found the tricky, I test this issue in different phone, only find out GlaxyII GT-9100 series phone will not crash. I find out that the clip mode using by UIPanel is set to be HardClip, it seems that UIDrawCall component will assign Transparent Colored ( HardClip ) shader to Atlas material; When I change HardClip into SoftClip, everything is ok whether on phone or on PC.

I try to compare both HardClip shader and SoftClip, only different in farg routine is HardClip using 'clip()' function to filter pixel alpha which is below zero, and SoftClip is caclulate alpha in farg itself.

I think maybe 'clip' function is not supported for every hardware since the GPU architecture was much more different from PC.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel Crash in Android
« Reply #7 on: June 06, 2012, 03:29:04 AM »
Yup, that's a reasonable guess.

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Re: UIDraggablePanel Crash in Android
« Reply #8 on: August 27, 2012, 05:38:29 PM »
I can confirm that with Unity 4.0b7 using Hard Clip on panels is still very risky in Android. The warning that Unity gives about using the clip() is no joke. I deployed an application that worked fine on my test Android devices (including some with Adreno GPUs), but for some reason something in the hardclip shader is really giving some GPUs a hard time on Android (probably due to very crappy drivers). They seem to handle the soft-clip shader option ok. I just wanted to bump this to reiterate that the problem still persists and to NOT recommend using the hard-clip shader. Instead the soft-clip or alpha clip should be safer.

Malzbier

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 93
    • View Profile
Re: UIDraggablePanel Crash in Android
« Reply #9 on: September 11, 2012, 09:08:34 AM »
Thanks Ferazel you saved my day.
Had some wird crashes on a Sony Xperia Play (800i).
Turnd out activating a Pannel with hard clipping was the error.
Now we are using soft clipping and everything runs fine.
Maybe there should be a warning somewere at the hard clip settings so that the user have  a chance the be warnd what they can hit.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel Crash in Android
« Reply #10 on: September 11, 2012, 10:11:07 AM »
As Ferazel points out, Unity itself warns you about using clip() on android devices.

Malzbier

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 93
    • View Profile
Re: UIDraggablePanel Crash in Android
« Reply #11 on: September 12, 2012, 04:06:42 AM »
In what version of unity they do the warning?
I haven't seen one in 3.5 so far.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel Crash in Android
« Reply #12 on: September 12, 2012, 04:28:57 AM »
I actually get it in 3.5.5.

serioustommy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
    • View Profile
Re: UIDraggablePanel Crash in Android
« Reply #13 on: October 29, 2012, 09:15:39 AM »
I'd just like to say that I got hit by this as well and soft clipping is what fixed it. Took me a lot of time to figure out though.

Unity didn't warn at compile time because the shader with clip instruction is only swapped in in real time when the draggable panel uses hard clipping.

I think a warning by NGUI in the console will save a lot of people headaches and time.  :)

Nox Noctis

  • Guest
Re: UIDraggablePanel Crash in Android
« Reply #14 on: October 29, 2013, 03:37:57 AM »
I have just stumbled upon this problem on the following devices:
HTC Sensation, HTC Desire, Samsung Galaxy SIII
They all have Qualcomm Adreno 2xx GPUs: 200, 220, 225 respectively.
Hard or alpha clipping shaders do not work for these for the reason you have already revealed in the posts above.
I have several draggable panels in my interfaces and they all got broken.

I've tested this on HTC One which has Qualcomm Adreno 320GPU and it works fine.

So, the only safe way to have a draggable panel with clipping in NGUI for Android is to set its clipping mode to "soft clipping".