Search Unity

Advertisement.Banner.SetPosition() Bug

Discussion in 'Unity Ads & User Acquisition' started by PeachyPixels, Apr 3, 2020.

  1. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Hello!

    I currently have an Android game (that supports banner ads) that is in play testing. One of the issues that has been raised is that on a few levels, the banner can get in the way of gameplay.

    I do not want the banner to show on the main menu, so it is shown on level start and hidden on level end and its position can be specified on a per level basis.

    The banner is being shown using the following code...

    Code (CSharp):
    1. while (!Advertisement.IsReady(...))
    2.     yield return new WaitForSeconds(0.25f);
    3.  
    4. Advertisement.Banner.SetPosition(...);
    5.  
    6. Advertisement.Banner.Show(...);
    And hidden like this...

    Code (CSharp):
    1. Advertisement.Banner.Hide();
    The trouble is, once the banner has been shown on one level (let's say bottom centre) then the next time it is shown (let's say top right) it will always show in the position it was first shown, no matter what is passed to SetPosition. So in this example, the banner will always be shown bottom centre regardless.

    I've tried moving SetPosition before IsReady but it doesn't make any difference. Any help would be much appreciated.

    I'm using Unity 2019.2.21f1 and Advertisment 3.4.4
     
    Last edited: Apr 6, 2020
  2. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    Hey @PInvoke, thanks for reporting this.

    I was able to reproduce the same thing in my internal test app. I'll check with the development team and see what's going on.
     
    PeachyPixels likes this.
  3. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Many thanks.
     
  4. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Hi kr-unity,

    Is there any news on a fix please? Am hoping it's a simple issue that can be released to the 3.4 stream?

    Failing that, do you know of a way to work around it please?
     
  5. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    Hey, sorry for the delay in responding. Unfortunately, we don't currently have an estimate for when this will be addressed. Apologies.
     
    PeachyPixels likes this.
  6. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Ok, thanks for the prompt reply.

    This has pretty much stopped me being able to use banner ads in my game (am sure I'm not the only one) so hopefully a fix won't be too long in the making.

    Are you aware of a way to work around it by any chance please?
     
  7. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    Unfortunately no, there currently isn't a way around this. I've made the SDK team aware that this is an issue, however, so keep an eye out and it may be addressed in a future version.
     
  8. djtim3000

    djtim3000

    Joined:
    Jun 5, 2018
    Posts:
    2
    Any update on this one? I need to be able to change the position of banner ads depending on the state of my game. Not being able to do something which seems to be a relatively simple implementation is incredibly frustrating. It feels as though Banner Ads are more or less an afterthought for Unity IAP package.
     
    Hagen and LLGD like this.
  9. Hagen

    Hagen

    Joined:
    Aug 16, 2014
    Posts:
    36
    Same situation here, I need the banner position to change to prevent critical interference with the game, but once executed
    Advertisement.Banner.SetPosition, it sticks with that value.
     
  10. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Hello! Any updates on this please? It doesn't strike me as a difficult issue to resolve, but it's been 6 months now and no news.
     
  11. unity_4XWcnhMEUZ043g

    unity_4XWcnhMEUZ043g

    Joined:
    Aug 27, 2020
    Posts:
    4
    14.1.2021. I get same problem still.
     
  12. Unity_Adamski

    Unity_Adamski

    Unity Technologies

    Joined:
    Jul 20, 2020
    Posts:
    110
    In order to change the banner position you will need to destroy the current banner instance you can do this by passing in 'true' when calling the hide function like below. Would you be able to try this and let me know if it still doesn't work for you?
    Code (CSharp):
    1. Advertisement.Banner.Hide(true);
     
  13. unity_4XWcnhMEUZ043g

    unity_4XWcnhMEUZ043g

    Joined:
    Aug 27, 2020
    Posts:
    4
    Yes, that helped in a way.
    Now my banners show at different positions when switching scenes.
    But I had to do some workaround.
    What I realized is that using Advertisement.Banner.Hide(true); in my case, does not hide the banner, like you would call Advertisement.Banner.Hide(); Maybe it gets destroyed internally, I don't know that, but the banner was still showing in TOP_LEFT corner. When I switched the scene, it showed TOP_RIGHT corner, but during the loading screen, a banner that was on TOP_LEFT was still showing. After loading scene has finished, TOP_LEFT stopped showing, and TOP_RIGHT shows up.
    So the workaround was to call it like this:

    Code (CSharp):
    1. Advertisement.Banner.Hide();
    [/QUOTE]
    Code (CSharp):
    1. Advertisement.Banner.Hide(true);
    and this code sequence produced the desired result.
    Thanks anyway.