- Home /
How to hide a rect
I imported an admob script, works and now i have these things on the screen, how do i hide them
rect.png
(187.9 kB)
Comment
Open the Admob Script and Remove any code that generates UI (probably an OnGUI function).
Answer by robbos729 · Dec 08, 2019 at 11:18 AM
@Anis1808 how do i do it with this code though?
public void OnGUI()
{
GUIStyle style = new GUIStyle();
Rect rect = new Rect(0, 0, Screen.width, Screen.height);
style.alignment = TextAnchor.LowerRight;
style.fontSize = (int)(Screen.height * 0.06);
style.normal.textColor = new Color(0.0f, 0.0f, 0.5f, 1.0f);
float fps = 1.0f / this.deltaTime;
string text = string.Format("{0:0.} fps", fps);
GUI.Label(rect, text, style);
// Puts some basic buttons onto the screen.
GUI.skin.button.fontSize = (int)(0.035f * Screen.width);
float buttonWidth = 0.35f * Screen.width;
float buttonHeight = 0.15f * Screen.height;
float columnOnePosition = 0.1f * Screen.width;
float columnTwoPosition = 0.55f * Screen.width;
Rect requestBannerRect = new Rect(
columnOnePosition,
0.05f * Screen.height,
buttonWidth,
buttonHeight);
if (GUI.Button(requestBannerRect, "Request\nBanner"))
{
this.RequestBanner();
}
Rect destroyBannerRect = new Rect(
columnOnePosition,
0.225f * Screen.height,
buttonWidth,
buttonHeight);
if (GUI.Button(destroyBannerRect, "Destroy\nBanner"))
{
this.bannerView.Destroy();
}
Rect requestInterstitialRect = new Rect(
columnOnePosition,
0.4f * Screen.height,
buttonWidth,
buttonHeight);
if (GUI.Button(requestInterstitialRect, "Request\nInterstitial"))
{
this.RequestInterstitial();
}
Rect showInterstitialRect = new Rect(
columnOnePosition,
0.575f * Screen.height,
buttonWidth,
buttonHeight);
if (GUI.Button(showInterstitialRect, "Show\nInterstitial"))
{
this.ShowInterstitial();
}
Rect destroyInterstitialRect = new Rect(
columnOnePosition,
0.75f * Screen.height,
buttonWidth,
buttonHeight);
if (GUI.Button(destroyInterstitialRect, "Destroy\nInterstitial"))
{
this.interstitial.Destroy();
}
Rect requestRewardedRect = new Rect(
columnTwoPosition,
0.05f * Screen.height,
buttonWidth,
buttonHeight);
if (GUI.Button(requestRewardedRect, "Request\nRewarded Ad"))
{
this.CreateAndLoadRewardedAd();
}
Rect showRewardedRect = new Rect(
columnTwoPosition,
0.225f * Screen.height,
buttonWidth,
buttonHeight);
if (GUI.Button(showRewardedRect, "Show\nRewarded Ad"))
{
this.ShowRewardedAd();
}
Rect textOutputRect = new Rect(
columnTwoPosition,
0.925f * Screen.height,
buttonWidth,
0.05f * Screen.height);
GUI.Label(textOutputRect, outputMessage);
}
Juste delete this whole part and you should have no more buttons
Your answer
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
How do I get (return) all the GUI inside(contained in) a GUI rect ? 2 Answers
Using Hidden folders for editor stuff? 1 Answer
Admob ads don't work 0 Answers
Multiple Cars not working 1 Answer