Author Topic: Touches go through interstitials with Chartboost Android  (Read 2311 times)

Biggix

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 33
    • View Profile
Touches go through interstitials with Chartboost Android
« on: March 13, 2015, 04:03:55 PM »
Hi,

I am using Unity 4.6.3 with the latest Chartboost SDK (11th March).

On iOS version, everything works fine.

On Android, the touches strangely trigger on both the interstitial/"X" button AND the underlying interface elements, resulting in unwanted UI interaction when user just wants to close the interstitial. Like the interstitial somehow passes the touches to the underneath layer, but it also performs the desired actions itself.

I have requested support from Chartboost but there is no reply.

Anybody knows what can be done? I thought of disabling and re-enabling the interface when the interstitial is displayed, but I don't know of a reliable way to do it without rewriting a massive chunk of the code.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Touches go through interstitials with Chartboost Android
« Reply #1 on: March 13, 2015, 10:09:56 PM »
NGUI simply retrieves events from Unity. If Unity says there is a touch, NGUI goes with it. Unless Chartboost somehow blocks touches from passing through it (which I highly doubt it does), then NGUI will get the touch events.

You need to put some high depth panel with a widget that has a collider on it that will cover your ads so that events don't propagate to the rest of the UI.

Biggix

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 33
    • View Profile
Re: Touches go through interstitials with Chartboost Android
« Reply #2 on: March 14, 2015, 05:57:11 AM »
Yeah I thought the same. But the problem is, on iOS everything works as it should. This "passing touches" problem exists only on Android. This is evidently a bug in their system and they don't confess it.

Biggix

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 33
    • View Profile
Re: Touches go through interstitials with Chartboost Android
« Reply #3 on: March 14, 2015, 06:58:04 AM »
I have found that the bug I experienced exists since November 2014. And they still haven't fixed it in Chartboost.

So, this is my workaround which seems to be working. Thanks ArenMook for the suggestion!

  1. void didDismissInterstitial(CBLocation location) {
  2.  
  3.                 if ((ChosenLevel == "0") && (RealCurrentLevel == 0)) {
  4.  
  5.                         if (GameObject.Find ("WallSprite")!=null) {
  6.  
  7.                                                 GameObject.Find ("WallSprite").GetComponent<UISprite> ().alpha = 0f;
  8.  
  9.                         }
  10.  
  11.                                 }
  12.  
  13.                 Chartboost.didDismissInterstitial -= didDismissInterstitial;
  14.         }
  15.        
  16.        
  17.         void didDisplayInterstitial(CBLocation location){
  18.  
  19.                 if ((ChosenLevel == "0") && (RealCurrentLevel == 0)) {
  20.  
  21.                         if (GameObject.Find ("WallSprite")!=null) {
  22.  
  23.                                                 GameObject.Find ("WallSprite").GetComponent<UISprite> ().alpha = 0.01f;
  24.  
  25.                         }
  26.  
  27.                                 }
  28.  
  29.                 Chartboost.didDisplayInterstitial -= didDisplayInterstitial;
  30.         }
  31.  
  32.  
  33.         void OnEnable() {
  34.  
  35.  
  36.                 GameObject.Find ("WallSprite").GetComponent<UISprite> ().alpha = 0f;
  37.  
  38.  
  39.                 #if UNITY_ANDROID
  40.                
  41.                 Chartboost.didDisplayInterstitial += didDisplayInterstitial;
  42.                 Chartboost.didDismissInterstitial += didDismissInterstitial;
  43.                
  44.                 #endif
  45.  
  46.                 }