1

You have a scene kit scene in your tvOS app.

As usual the scene kit is part of a normal view controllert.

Nowdays you can in fact do this:

    someNode.focusBehavior = .focusable

reference - https://developer.apple.com/documentation/uikit/focus-based_navigation/adding_user-focusable_elements_to_a_tvos_app

As it says, "To make a SceneKit or SpriteKit node focusable, set the focusBehavior property of the node to focusable"

However when you do this, you will simply get a crash:

'Focus item <SCNNode: 0x600003bc5d00> has a parent focus environment of <SCNNode: 0x600003bc3d00> but this environment does not provide a container for focus items.'

You cannot do this or this, they ar read only:

    // can't do this -
    someNode.parentFocusEnvironment = ...
    // can't do this -
    someNode.focusItemContainer = ...

I can't seem to set them in a subclass (overriding) and indeed - I'm not sure what they should be set to!!

How do you add scene kit nodes to the focus container of ordinary nodes (say, buttons) in the view controller?

Fattie
  • 27,874
  • 70
  • 431
  • 719

0 Answers0