Search Unity

Question Unity Admob banner overlaps gui

Discussion in 'Immediate Mode GUI (IMGUI)' started by SiegeMinion, Jan 30, 2021.

  1. SiegeMinion

    SiegeMinion

    Joined:
    Apr 4, 2020
    Posts:
    15
    HI! am trying to use admob smart banner ads on landscape mode but i have a problem where they overlap my gui canvas. I use a gameobject with the following code
    Code (CSharp):
    1.  
    2. int CalculateBannerHeight()
    3. {
    4.    if (Screen.height <= 400 * Mathf.RoundToInt(Screen.dpi / 160))
    5.    {
    6.        return 32 * Mathf.RoundToInt(Screen.dpi / 160);
    7.    }
    8.    else if (Screen.height <= 720 * Mathf.RoundToInt(Screen.dpi / 160))
    9.    {
    10.        return 50 * Mathf.RoundToInt(Screen.dpi / 160);
    11.    }
    12.    else
    13.    {
    14.        return 90 * Mathf.RoundToInt(Screen.dpi / 160);
    15.    }
    16. }
    17.            rectTransform.offsetMax = new Vector2(rectTransform.offsetMax.x, -CalculateBannerHeight());
    to push the content of the gui down so it wont overlap anymore but it ends up going down too much. Is there anyway to make the canvas go down just enough so it wont overlap?
     
  2. SiegeMinion

    SiegeMinion

    Joined:
    Apr 4, 2020
    Posts:
    15
    bump anyone?