0

I'm trying to display a GADBannerView in a SCNPlane. Code looks more or less like this:

let banner = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)
banner.rootViewController = self
banner.load(GADRequest())

let viewMaterial = SCNMaterial()
viewMaterial.diffuse.contents = bannerView

let plane = SCNPlane(width: 320, height: 50)
plane.materials = [viewMaterial]

let planeNode = SCNNode(geometry: plane)
planeNode.position = SCNVector3(0, 5, -10)

sceneView.scene.rootNode.addChildNode(planeNode)

This kind of works but the banner is displayed like this, i guess the GADBannerView has some transparent stuff going on which is not handled correctly: enter image description here

Is this even possibly? If yes how, if not why not. ;)

chris
  • 600
  • 7
  • 21

1 Answers1

0

Displaying UIView hierarchies as the contents of a SCMaterialProperty is not documented and not supported.

mnuages
  • 13,049
  • 2
  • 23
  • 40
  • I guess so, a hackaround for static image ads worked for me by rendering the view as a UIImage and setting this as content of SCMaterialProperty, it´s even clickable. – chris Aug 08 '19 at 12:25
  • mnuages : Is it possible display different Ads on each recurring items? – Priya Jun 22 '20 at 01:19