- Home /
iAds scripting problem
I am trying to get an iAd banner in my unity ios game, but when I use this code:
private ADBannerView banner = null;
void Start()
{
banner = new ADBannerView(ADBannerView.Type.Banner, ADBannerView.Layout.Top);
ADBannerView.onBannerWasClicked += OnBannerClicked;
ADBannerView.onBannerWasLoaded += OnBannerLoaded;
}
void OnBannerClicked()
{
Debug.Log("Clicked!\n");
}
void OnBannerLoaded()
{
Debug.Log("Loaded!\n");
banner.visible = true;
}
I get this error message: Assets/scripts/iAds.cs(1,22): error CS0116: A namespace can only contain types and namespace declarations
Is this your whole script? If you are intending to use C# you need to include the appropriate wrappers.
Sorry, i'm new to C#. (Also a complete idiot) what exactly is a wrapper? I'm using the unity scripting API, BTW. I'm used to very basic javascript.
Your answer
![](https://koobas.hobune.stream/wayback/20220613153437im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to implement iAd Banner correctly 0 Answers
Cannot add menu item 'Assets/External Dependency Manager/Version Handler/Update' for method ..... 1 Answer
Banner Ad Without Button 0 Answers
John Lemon Tutorial "An error occurred while resolving packages" 0 Answers
I can't finish unity ads activation at unity dashboard! 2 Answers